home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / UTILITY / DOSIMP12.ARJ / SIMPLY5.HYP < prev    next >
Text File  |  1992-01-16  |  111KB  |  1,982 lines

  1.                         What Are |tExecutable|t Files?
  2.  
  3. An |nexecutable|n file actually means  any file with the extension .EXE,  but
  4. in general, it means any file that the computer can execute as a command.
  5. There are two |nexecutable|n extensions other than  .EXE,  and they are  .COM
  6. and  .BAT.   A file with the  .BAT extension is a batch file,  and a file
  7. with the  .COM extension  is a command file.   There's another misleading
  8. term, because generally any .EXE, .COM, or .BAT file is a command.
  9.  
  10. Files that do not have  one of these three extensions cannot be executed.
  11. They can only be used as parameters to some other command.   For example,
  12. .SYS files are |sdevice driver|ss  which are used as parameters to the DEVIC|1E
  13. command in the CONFIG.SYS file.   .WK1 files are spreadsheets, .DBF files
  14. are data bases,  .DOC files are word processor documents,  .BAS files are
  15. program files in the BASIC language  that can only be read  by the BASIC,
  16. BASICA,  GWBASIC,  or QBASIC interpreters.   These are just a few  of the
  17. most common non-|nexecutable|n file extensions.
  18.  
  19. When executing a command,  it is not necessary to type the command file's
  20.                      <page down> for more Executable
  21. extension, just the filename.  First DOS looks at the copy of COMMAND.COM
  22. in memory to see if there is an internal command with that name.   If so,
  23. DOS will execute the command.   If not, DOS will look in the current dir-
  24. ectory for a file with that name and the extension  .COM.   If not found,
  25. DOS will look for a file with that name and an .EXE extension, and if not
  26. found, a .BAT extension.   If none of those are found in the current dir-
  27. ectory,  then DOS will search for those same filenames  in each directory
  28. listed on the  PATH variable  in the environment.   If no |nexecutable|n file
  29. with that name  is found  in any of  these places,  you'll see the famous
  30. "|tBad command or filename|t" message.
  31.  
  32. However,  if the full file specification (|spath|sname) to the command is in-
  33. cluded on the command line,  the only place  DOS will search for a  .COM,
  34. .EXE, or .BAT file with that name,  is in that specified |sdirectory|s!   DOS
  35. won't even execute an internal command if one exists by that name, if the
  36. directory  is specified  on the command line.   So if you should for some
  37. reason need to have a command file named |nCLS|n.EXE,  it is possible to have
  38. that file executed  even though  DOS searches  the internal command table
  39. before searching any directories.   You just need to specify  the path to
  40.                      <page down> for more Executable
  41. the |nCLS|n.EXE file  on the command line,  or else if the |nCLS|n.EXE  is in the
  42. current directory, use the shortcut .\CLS.  (See also ". and ..".)   That
  43. will execute the |nCLS|n command file rather than the CLS internal command.
  44.  
  45. If you have a file named HELLO.EXE and a file named HELLO.COM,  or if you
  46. have two different HELLO.COM files in two different directories,  the one
  47. that's closest  to the beginning  of the PATH variable  is always the one
  48. that will  get executed,  unless you're  in the  same directory  with the
  49. other one, or you specify the |spath|sname on the command line.
  50.  
  51. Now here's something interesting that I recently found out.  Every single
  52. DOS book that I've ever read  which has brought up this subject  has said
  53. the following:   If there is a .COM file,  an .EXE file,  and a .BAT file
  54. with the same  first name,  in the same directory,  then there is  no way
  55. the .EXE or .BAT files  will ever be executed,  not even if you enter the
  56. command as FILE.EXE or FILE.BAT,  because DOS will just ignore the exten-
  57. sion of the file  and look for a command in the normal order:   internal,
  58. then .COM, then .EXE, and then .BAT.
  59.  
  60.                      <page down> for more Executable
  61. Well that was true  in earlier versions  of DOS,  but it is not true  any
  62. more, and the DOS manual authors just haven't figured it out yet.  I just
  63. copied |nCHKDSK|n.COM and |nGWBASIC|n.EXE to an empty directory,  renamed them to
  64. TEST.COM and TEST.EXE,  and created a TEST.BAT file that just said, "|sECHO|s
  65. It works!"   Now what I had was three different commands that all had the
  66. first name of TEST.   So I entered the command TEST and what got executed
  67. was CHKDSK, which had been renamed to TEST.COM.   That's just what should
  68. have happened.
  69.  
  70. Now according to all the DOS books, when I entered TEST.EXE as a command,
  71. I should have gotten a CHKDSK report once again.   Nope.   I got GWBASIC.
  72. Then when I entered TEST.BAT, I got "It works!"
  73.  
  74. This works for me with MS-DOS versions 4.01 and 5.0,  but not with 3.2 or
  75. 3.3.   But even the books that say  they are updated for version 4.01 are
  76. still saying it can't be done.  This just goes to show that you can't al-
  77. ways be sure of anything when it comes to computers.   Just because some-
  78. thing was true in 1983 doesn't mean it's still true in 1991,  even if all
  79. the DOS books are still saying it!
  80.                      <page down> for more Executable
  81. As a matter of fact,  remember what I said  about executing an  .EXE file
  82. with the same first name as an internal command,  like |nCLS|n.EXE?   All the
  83. books also say that is impossible, unless you patch your COMMAND.COM file
  84. to change the name of the internal CLS command.   But it's not true.  You
  85. don't have to patch COMMAND.COM to execute a |nCLS|n.EXE file.  You just have
  86. to specify the |spath|sname of the file on the command line, like I said.   I
  87. just tested it on  MS-DOS versions 3.2, 4.01, and 5.0 to make sure before
  88. I said it.  No problem.
  89.  
  90. Books are not always right!   (Now doesn't it make you feel good, to know
  91. that?)   These things were true for so long,  in all the earlier versions
  92. of DOS,  that everyone,  even the authors of the DOS books,  just accepts
  93. them as gospel,  without even testing  to find out  whether they're still
  94. true or not.
  95.  
  96. (As a matter of fact,  I have about two dozen DOS books, and over half of
  97. them are chock full of errors, typos, mistakes, and misinformation.  It's
  98. just about as silly to trust a computer book as it is to trust a computer
  99. salesman!)
  100.                      <page down> for more Executable
  101. Ready for some more confusion?   |nExecutable|n files can be called commands,
  102. utilities, programs,  or applications!   There are some vague differences
  103. between these terms, but they're basically interchangeable, more or less.
  104. Internal commands, those that are inside the COMMAND.COM file, are defin-
  105. itely called commands.   The DOS commands  that require  |nexecutable|n files
  106. can be called external commands, or DOS utilities, or DOS programs.   Ex-
  107. ecutable files that don't come from DOS  can be called programs,  utilit-
  108. ies,  or applications.   A utility  almost always refers to  some command
  109. that performs  a very specific function,  and that does not  require  any
  110. overlay or support files.  A program can mean either a utility or an app-
  111. lication.   And an application is usually a great big program that should
  112. have a whole directory all to itself,  that has a whole bunch of |soverlay|ss
  113. and support files, that is used to do your work, not just for things that
  114. are only related  to the computer  itself.   Examples of applications are
  115. word processors, database managers, spreadsheets, desktop publishers, ac-
  116. counting or payroll programs, things like that.  But you can't run any of
  117. these without an |nexecutable|n file, with the .COM, .EXE, or .BAT extension.
  118.  
  119.  
  120.                    <page down> for What Is COMMAND.COM?
  121.                            What Is |tCOMMAND.COM|t?
  122.  
  123. This is one of the top three  most important files  on your system.   The
  124. others are IO.SYS and MSDOS.SYS for MS-DOS,  or IBMBIO.COM and IBMDOS.COM
  125. for PC-DOS.   Without  these three files  in the right place  so that the
  126. computer knows where to find them, the computer can't even boot up.
  127.  
  128. |nCOMMAND.COM|n is the part of DOS  that interprets every command you type in
  129. at the DOS prompt.   It also has lots of commands inside of it, and these
  130. are called |tinternal|t commands.  Here is a list of them:
  131.       BREAK   CLS    DEL     EXIT   LOADHIGH   PROMPT   SET        TYPE
  132.       CALL    COPY   DIR     FOR    MKDIR      REM      SHIFT      VER
  133.       CHCP    CTTY   ECHO    GOTO   PATH       RENAME   TIME       VERIFY
  134.       CHDIR   DATE   ERASE   IF     PAUSE      RMDIR    TRUENAME   VOL
  135. As long as your version of DOS includes these commands, you can enter any
  136. of them at any prompt, any time, whether you have a PATH variable in your
  137. environment  at the moment,  or not.   (|sGOTO|s, PAUSE, REM,  and SHIFT  are
  138. batch file commands that have no useful purpose at the command line.)
  139.  
  140.                      <page down> for more COMMAND.COM
  141. These are some other commands  that can sort of be considered as internal
  142. commands,  because the code  that tells DOS how to execute them is inside
  143. the IO.SYS file (or the IBMBIO.COM file if you're using PC-DOS), and they
  144. can only be used from within the CONFIG.SYS file, not at the command line
  145. or from a batch file or anything like that:
  146.     BREAK   COUNTRY DEVICEHIGH DRIVPARM FILES   LASTDRIVE SHELL  SWITCHAR
  147.     BUFFERS DEVIC|1E  DO|1S        FCBS     INSTALL REM       STACKS SWITCHES
  148. They're  really not  referred to as internal commands,  though.   They're
  149. usually just called  CONFIG.SYS commands.   (Yes,  BREAK and REM are both
  150. internal commands and  CONFIG.SYS commands.   The code that executes them
  151. is in both the IO file and the |nCOMMAND.COM|n file,  so they can be executed
  152. from CONFIG.SYS or the command line or a batch file.)
  153.  
  154. All the rest  of the DOS commands  are |texternal|t,  and that means  that in
  155. order to execute them  you have to have  the executable file by that name
  156. available to DOS in order for DOS to run the command.
  157.  
  158. See also SHELL, COMSPEC, COMMAN|1D, and Shelling Out  for more information.
  159.  
  160.                    <page down> for The COMMAND Command
  161.                            The |TCOMMAN|1D|T Command
  162.  
  163. COMMAND is the command  that activates a secondary shell  of COMMAND.COM.
  164. Secondary shell, you ask?   Well yes, because if there were not already a
  165. primary COMMAND.COM shell, then your computer would just be sitting there
  166. giving you a cold stare, not even a prompt.   A COMMAND.COM shell is what
  167. gives you a prompt and then interprets the commands that you enter at the
  168. prompt.   That's why it's also called the Command Interpreter.   It might
  169. be called a shell  because it protects you  from having to deal with  the
  170. actual binary language that the computer can understand.
  171.  
  172. Well if you do a lot of shelling out to DOS from inside some application,
  173. what that application is doing  is using the COMSPEC variable to find out
  174. where your COMMAND.COM file is, and loading another copy of that file in-
  175. to memory right over top of the application you're working on.   When you
  176. are done with what you wanted to do in DOS, you type EXIT and hit <Enter>
  177. and the secondary COMMAND.COM shell  drops back out of memory  and leaves
  178. you right where you were before, in that application.
  179.  
  180.                        <page down> for more COMMAN|1D
  181. Well you can also shell out to a secondary command interpreter right from
  182. the primary command interpreter,  without using some application that has
  183. a shelling out option, as a middle man.  You probably won't need to do it
  184. very often, but when you do, COMMAND is the command you use.
  185.  
  186. About the most  common reason  for a beginner to need  to shell out  to a
  187. secondary COMMAND.COM is in order to call a second batch file from inside
  188. another batch file.   Of course if you have DOS version 3.3 or later, you
  189. would want to use the CALL command.   But since that command didn't exist
  190. until DOS version 3.3,  some people still need to use the COMMAND command
  191. to accomplish this.
  192.  
  193. You see, if you just enter the name of a second batch file,  as a command
  194. in the first batch file,  then control will be passed permanently to that
  195. second batch file.  When the second batch file is done, you'll just get a
  196. DOS prompt,  and whatever commands were still remaining to be executed in
  197. the first batch file,  will never be seen by DOS.   So if you want DOS to
  198. come back  to the first batch file  after the second batch file  is done,
  199. you need the CALL command if you have DOS 3.3 or later,  or else you need
  200.                        <page down> for more COMMAN|1D
  201. the COMMAND command with the /C switch.  Here is FIRST.BAT:
  202.           ECHO This is the first batch file
  203.           COMMAND /C SECOND
  204.           ECHO Back in the first batch file again
  205. And here is SECOND.BAT:
  206.           ECHO This is the second batch file
  207. Now when you run FIRST.BAT, the first ECHO command will be executed, then
  208. a secondary  command shell  will be loaded  and the /C switch  tells that
  209. secondary shell  to execute the command following the /C.   So SECOND.BAT
  210. will be called,  and then as soon as  it's done,  since the /C switch was
  211. used with  the COMMAND command,  the secondary shell  will drop right out
  212. of memory just as if you had issued the EXIT command,  and then FIRST.BAT
  213. will continue on with the next ECHO command.
  214.  
  215. If you don't use the /C switch with the COMMAND command, then you can run
  216. whatever commands or programs you want, and the secondary processor won't
  217. drop out of memory until you give the EXIT command.
  218.  
  219. If you ever  want to perform  some DOS command  in the middle  of a batch
  220.                        <page down> for more COMMAN|1D
  221. file, and then return to that batch file,  you could do it if you had the
  222. COMMAND command in that batch file.   The batch file would start running,
  223. and then when it got to the COMMAND command,  you'd get a DOS prompt, and
  224. you could do whatever you wanted,  and then when you type EXIT, that sec-
  225. ond COMMAND.COM would drop out of memory  and the batch file would finish
  226. executing.
  227.  
  228. Whenever you load  a secondary command processor,  it gets a copy of your
  229. |ncurrent|n environment.  So it has the same PATH, PROMPT, and COMSPEC varia-
  230. bles that you already had,  plus whatever else you might have had in your
  231. environment.   Then you can do whatever you want to do  with the environ-
  232. ment while you're in the secondary shell,  and it will not affect the or-
  233. iginal environment.   When you EXIT back to  the primary shell,  you will
  234. still have the exact same environment you had  before you loaded the sec-
  235. ondary shell.
  236.  
  237. Also whenever you load a secondary command shell,  it starts out with the
  238. default ECHO ON.   So if you use COMMAND /C  to call a second  batch file
  239. from within another batch file,  it does not inherit  the same ECHO state
  240.                        <page down> for more COMMAN|1D
  241. that existed in the first batch file,  as happens with  the CALL command.
  242. Even if  ECHO was off  in the first batch file,  you'll have to have  the
  243. command ECHO OFF  at the beginning  of the second  batch file too  if you
  244. want it to have its ECHO off as well.
  245.  
  246. If you ever run some other shell besides COMMAND.COM, such as the wonder-
  247. ful shareware program from J. P. Software called 4DOS, that's another oc-
  248. casion you might be interested in using the COMMAND command.  Suppose you
  249. are running 4DOS  as your primary command interpreter,  and you're having
  250. trouble  getting some  particular command  to work.   You decide that you
  251. would like to try the same command in regular DOS,  to see if it's just a
  252. quirk in 4DOS that's giving you trouble, or what.  Well you don't have to
  253. edit your CONFIG.SYS file and reboot in order to load a copy of the regu-
  254. lar COMMAND.COM to test your theory.  You just use the COMMAND command to
  255. load a secondary shell, try out that command that's giving you trouble in
  256. 4DOS, and then use the EXIT command to remove the secondary shell.  (This
  257. was not to imply  that I think you will find any quirks in 4DOS.   It's a
  258. fantastic program!   It does just about  everything  that you ever wished
  259. DOS would do but didn't.  4DOS is about 99.99999% compatible with all the
  260.                        <page down> for more COMMAN|1D
  261. applications you use under regular DOS, but it's so much better than reg-
  262. ular DOS!  It's even better than DOS version 5!)
  263.  
  264. Here's another use for the COMMAND command.   Have you ever wanted to use
  265. a nested FOR command,  that is, a FOR command inside another FOR command?
  266. Kinda the same as  using COMMAND or CALL  to run another batch file  from
  267. within a first batch file.  Well in general it's not possible to nest FOR
  268. commands.  But it can be done using the COMMAND /C command.  Want to copy
  269. all the .BAT files from the BELFRY directory, and all the .BAT files from
  270. the UTIL directory, to the disk in drive B:, all in one command?  FOR %%A
  271. IN (\BELFRY \UTIL)  DO COMMAND /C  FOR %%B IN (%%A\*.BAT)  DO COPY %%B B:
  272. would do it.  Not that you'll probably ever want to, but isn't it nice to
  273. know that it can be done if you ever do?
  274.  
  275. The COMMAND command also has a /P switch,  which you might recognize from
  276. the SHELL command in your CONFIG.SYS file.   The switch doesn't belong to
  277. the SHELL command,  but to the  COMMAND command.   It causes  the command
  278. processor being invoked, to become the primary command processor, even if
  279. there already is  a primary one loaded.   This means that it will run the
  280.                        <page down> for more COMMAN|1D
  281. AUTOEXEC.BAT file,  and that it cannot  be exited with  the EXIT command.
  282. The only way to get rid of  a command shell that was invoked with  the /P
  283. switch,  is to reboot.   So you probably  won't ever want  to use the  /P
  284. switch except for with the SHELL command in CONFIG.SYS.
  285.  
  286. If you use the COMMAND command from within a batch file, it's a good idea
  287. to use  %COMSPEC%  to reference it.   COMSPEC is  an environment variable
  288. that points to where  your copy of COMMAND.COM is located.   And the per-
  289. cent signs are a way that is used in batch files to reference environment
  290. variables.   Whenever DOS's batch file interpreter sees a word surrounded
  291. by percent signs, it looks into the environment to see if there is a var-
  292. iable by the name of the word that's inside the percent signs.   If there
  293. is, then DOS temporarily replaces the word  (for example %COMSPEC%)  with
  294. whatever the word is SET equal to in the environment (for example C:\DOS\
  295. COMMAND.COM).   So if you put %COMSPEC% into your batch file  in place of
  296. the word COMMAND,  then DOS will replace that with C:\DOS\COMMAND.COM (if
  297. that's where  your COMMAND.COM file is)  and the correct copy  of COMMAND
  298. .COM will be loaded as the secondary shell.  This is good for in case you
  299. ever end up with some other copy of COMMAND.COM  on your disk in a direc-
  300.                        <page down> for more COMMAN|1D
  301. tory that's closer  to the beginning of your PATH variable  than the copy
  302. of COMMAND.COM that is the one you really want to run.   Because DOS will
  303. execute the first COMMAND.COM it finds  on the path if you just say  COM-
  304. MAND in the batch file.  If you say %COMSPEC% instead, in the batch file,
  305. then you know for sure that the correct copy of  COMMAND.COM gets loaded.
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.                   <page down> for What Is Shelling Out?
  321.                           What Is |tShelling Out|t?
  322.  
  323. Many applications  have a menu choice  where you can get to  a DOS prompt
  324. without actually exiting from the application.   Then you can do whatever
  325. it was that you wanted to do in DOS,  and then when you type |nEXIT|n you get
  326. taken right back  to the point where you had been inside your application
  327. before you went to the DOS prompt.  This is called "shelling out" to DOS.
  328.  
  329. The reason it's called that,  is because COMMAND.COM, your command inter-
  330. preter,  is also called a command shell.   When you shell out to DOS from
  331. within another application, what the application does is load a secondary
  332. copy of COMMAND.COM into memory on top of itself, and you do your work in
  333. that secondary shell.  The application does that by executing the COMMAN|1D
  334. command, or by using the COMSPEC environment variable to call COMMAN|1D.
  335.  
  336. The |TEXIT|T command  causes the secondary command shell  to drop out of mem-
  337. ory, and you find yourself right back where you were before the secondary
  338. shell had been loaded on top of what you had been doing.
  339.  
  340.                     <page down> for more Shelling Out
  341. If you forget that you're in a secondary command processor, and you don't
  342. use the EXIT command to get back into the application,  and exit the app,
  343. before you  turn the computer off  for the day,  then not only  will your
  344. work that you'd been doing inside the application  not get saved to disk,
  345. but also you could end up with all sorts of strange files on your disk.
  346.  
  347. Many applications make temporary working files on the disk, to keep track
  348. of things that they're doing that don't all fit in memory.  When you exit
  349. the application,  it automatically cleans up after itself and deletes the
  350. temp files  that it had  been using.   If you don't  exit the application
  351. properly before turning off the computer,  the application never gets the
  352. chance to delete those files.
  353.  
  354. Also,  many applications create  yet another temp file on the disk,  when
  355. you shell out to DOS,  to remind itself  how to get back to where it was,
  356. whenever you're done in DOS and type the EXIT command.   When you do type
  357. EXIT and go back to the application,  the app uses that temp file to find
  358. its way back,  and then it deletes that temp file.   So if you don't ever
  359. use the EXIT command  to get back to the app,  then there's  another temp
  360.                     <page down> for more Shelling Out
  361. file that stays on your disk.
  362.  
  363. An awful lot of beginners (and non-beginners too)  have this problem with
  364. the DOSSHELL.   It leaves all kinds of temp files laying around, and most
  365. users just can't figure out  where they come from.   Well, they come from
  366. not properly exiting the DOSSHELL.   But I wouldn't say that's the user's
  367. fault,  because the  Microsoft documentation  does a terrible job  of ex-
  368. plaining all the different ways of exiting the DOSSHELL.  You can use the
  369. "Command Prompt" option in the Main Group, or the Shift-F9 keystroke com-
  370. bination, to shell out to DOS.  But if you type DOSSHELL to get back from
  371. there,  then what you've done is  load a second copy of the DOSSHELL into
  372. memory on top of the first COMMAND.COM,  first DOSSHELL,  and second COM-
  373. MAND.COM.   You don't want to do that.   If you use Shift-F9  or "Command
  374. Prompt" to get out of the DOSSHELL, then you have to use the EXIT command
  375. to get back in.   Because those two options don't exit the DOSSHELL, they
  376. just shell out to a second copy of COMMAND.COM.   There are three ways to
  377. really and truly exit the DOSSHELL, and they all do the exact same thing.
  378. The F3 key,  the Alt-F4 combination,  and the Exit option under the Files
  379. menu.   If you always use  EXIT instead of  DOSSHELL to get back in after
  380.                     <page down> for more Shelling Out
  381. having shelled out,  and if you always  use one of  the three  methods of
  382. exiting the DOSSHELL before you shut off the computer or reboot, then the
  383. |sDOSSHELL|s's temp files will never get left lying around on your hard disk.
  384. Except of course, once in a while when an application that you had start-
  385. ed from the DOSSHELL locks up on you, and the only way you can get out of
  386. the lockup is to reboot.   But that just happens sometimes.   It can't be
  387. helped.
  388.  
  389. In DOS version 4, the |sDOSSHELL|s's temp files have names like 10370F37, and
  390. the version  5.0 DOSSHELL  has some really weird ones  like 04E2DOSC.BAT,
  391. ~7924D01.SWP, and stuff like that.  If you use the task swapper, one temp
  392. file for each program you're swapping will be a really huge (around 600K)
  393. Hidden file.   You'll have to use the  /AH switch with the DIR command in
  394. order to even see their names, and use the ATTRIB command to remove the H
  395. attributes before you can delete them if they get left behind.
  396.  
  397. So that's how it works  with the DOSSHELL,  but what about  all the other
  398. applications  that allow you to shell out to DOS?   They work exactly the
  399. same way, but with different keystrokes.  How do you know you're properly
  400.                     <page down> for more Shelling Out
  401. exiting them?  Well if the program's documentation doesn't make it clear,
  402. then just try this:   Exit the program the way you normally do,  and when
  403. you get to the DOS prompt,  type EXIT and  hit the <Enter> key.   If that
  404. takes you back into your program,  then you know that the method of exit-
  405. ting you've been using  doesn't really  exit the program,  it only shells
  406. out to DOS.   Get out that program's manual  and find out the real way to
  407. exit, and always use that way before you shut off the computer.
  408.  
  409. If typing EXIT at the DOS prompt locks up your computer without even giv-
  410. ing you a message or a prompt, then you have indeed found the way to com-
  411. pletely exit your program to the primary copy of COMMAND.COM, but you al-
  412. so have a SHELL command  in your CONFIG.SYS file  that doesn't have  a /P
  413. switch.   The /P switch is what makes the primary COMMAND.COM  permanent,
  414. so if you don't have one, and you type EXIT, then the primary COMMAND.COM
  415. drops out of memory  just like a secondary one would,  leaving you with a
  416. computer that doesn't even know how to show you a prompt.   If you have a
  417. SHELL command in CONFIG.SYS,  it has to have a /P switch.   Then the EXIT
  418. command won't have any effect on the primary COMMAND.COM.   It just won't
  419. do anything at all.  Which is exactly what you want if you ever type EXIT
  420.                     <page down> for more Shelling Out
  421. while you're already in the primary COMMAND.COM.
  422.  
  423. What if you already have some of those funky numbered files on your disk?
  424. Well,  they're probably  just temp files  from your  not properly exiting
  425. some application,  in which case  there's no reason  not to  delete them.
  426. They're just taking up space on your disk for nothing.   Once an applica-
  427. tion is restarted, it has lost its place in the old temp file and there's
  428. no way  it can use it  again.   It can only create a new temp file.   But
  429. just in case  the strangely-named files  you have on your disk  right now
  430. are  something that  one of your  applications requires,  COPY them  to a
  431. floppy for safe-keeping before you delete them from your hard drive,  and
  432. then  after you see  that your app  still runs just fine,  you can delete
  433. them from the floppy too.  If your app doesn't run anymore, then you know
  434. that one or more of those files was something necessary,  instead of just
  435. a temp file.  So copy them back one by one, to figure out which one it is
  436. that  your app needs,  leave that one  on your disk  and just  delete the
  437. others.
  438.  
  439. If you have an application  from which you like to  shell out a lot,  and
  440.                     <page down> for more Shelling Out
  441. you run that application from a batch file, there is something you can do
  442. to make it  easy for you  to remember  that you're in  a secondary  shell
  443. rather than  the primary one.   Suppose the name  of this app is WORD and
  444. the batch file from which you run it, is WP.BAT:
  445.           @|sECHO|s OFF
  446.           CD C:\WORD
  447.           PROMPT Shelling from WORD--Type EXIT to return$_$P$G
  448.           WORD
  449.           PROMPT $P$G
  450.           CD \
  451. Now every time you run the WORD application by using WP.BAT,  your prompt
  452. will be changed from:
  453.           C:\WORD>
  454. to:
  455.           Shelling from WORD--Type EXIT to return
  456.           C:\WORD>
  457. so that if you shell out  to DOS,  that's the prompt  you'll see  and you
  458. can't possibly forget  that you're in  a secondary shell,  and then after
  459. you exit from the WORD application,  the batch file puts your prompt back
  460.                     <page down> for more Shelling Out
  461. to the normal  C:\WORD>  before it changes back to the root directory and
  462. leaves you in DOS.
  463.  
  464. Or if you're using the DOS version 5.0 DOSSHELL (this may or may not also
  465. work in the version 4 DOSSHELL; I don't know because I've never used it),
  466. you can change  the properties screen of the  "Command Prompt" Main Group
  467. menu choice, to make the command that it executes look like this:
  468.   PROMPT Type EXIT to Return to Shell$_$P$G ; CLS ; COMMAN|1D ; PROMPT $P$G
  469. so that whenever you use the "Command Prompt" menu option to shell out to
  470. DOS, it will remind you that you're in a secondary shell, and it will al-
  471. so clear the screen for you since the DOSSHELL will mess up any color you
  472. had set up using ANSI.SYS, which the CLS command will put back to normal.
  473.  
  474. Many programs, including the version 5 DOSSHELL  (but not the one in ver-
  475. sion 4),  use an environment variable named TEMP  (or in some cases, TMP)
  476. to decide where to keep their temp files.   So if you have a RAMdisk, put
  477. the line  SET |sTEMP|s=D:\  (assuming your |sRAMdisk|s's drive letter is D:) into
  478. your AUTOEXEC.BAT file,  and all the temp files for the programs that use
  479. the TEMP variable will be kept on the RAMdisk.   Not only does this speed
  480.                     <page down> for more Shelling Out
  481. up the program, because the RAMdisk is so much faster than the hard disk,
  482. but it also takes care of the leftover temp file problem.  Because every-
  483. thing on a RAMdisk disappears when you reboot, so the temp files will al-
  484. ways get deleted even if you don't properly exit the program that created
  485. them.  Of course this only applies to programs that use the TEMP variable
  486. to decide where to put their temp files.   Programs that don't,  won't be
  487. putting the files on the RAMdisk  unless you have some other way of tell-
  488. ing them to.
  489.  
  490. What if you have an application that offers a menu choice of |nshelling out|n
  491. to DOS, but it never works?  Well most applications use the COMSPEC vari-
  492. able in the environment to find your copy of COMMAND.COM and load it, but
  493. there are some poorly-written applications that don't do that.  They look
  494. in the root directory  of the boo|1t disk  to find a file named COMMAND.COM
  495. and they load that, without even looking to see what the COMSPEC variable
  496. has to say.  If you have an application that does that, and you really do
  497. want to be able  to shell out  from that app,  then you will have to just
  498. leave your COMMAND.COM file in the root directory,  and adjust your SHELL
  499. statement in CONFIG.SYS accordingly (or even remove it altogether).
  500.                      <page down> for The |nCOPY|n Command
  501.                              The |TCOPY|T Command
  502.  
  503. This is the command you use  to make a copy of one file and put that copy
  504. somewhere else.   The original file stays right where it was before.  The
  505. syntax is pretty straightforward:
  506.           |nCOPY|n D:\DIR\FILE1.EXT D:\DIR\FILE2.EXT
  507. where D: is  the drive letter  for the original source file and the drive
  508. letter  for the copy  on the target drive.   |nDIR|n is the directory for the
  509. original source file and the directory  for the copy on the target drive.
  510. And FILE#.EXT is the filename and extension  for the original source file
  511. and the filename and extension for the copy on the target drive.
  512.  
  513. Most of those parts  of the command  can usually be left out though.   If
  514. the source file  is in the current directory  of the current drive,  then
  515. the first  D:\DIR\  part can be  left out.   (COPY FILE1.EXT D:\DIR\FILE2
  516. .EXT)   If the copy of the file that is to be placed  on the target drive
  517. is to have the same filename  and extension as the source file,  then the
  518. FILE2.EXT part can be left out.   (COPY D:\DIR\FILE1.EXT D:\DIR)   If the
  519. current drive  and directory are the target,  and the filename and exten-
  520.                         <page down> for more COPY
  521. sion are to remain the same  as the source,  then the entire  target half
  522. of the equation can be left out.  (COPY D:\DIR\FILE1.EXT)
  523.  
  524. Target files  always start out  with their  Archive attributes set to on,
  525. because  they have just been created.   But even if the source file had a
  526. Read-only attribute,  the target file will not.   You'll  have to use the
  527. ATTRIB command to set the R attribute of the target file if you want to.
  528.  
  529. The |nCOPY|n command  can also be used to combine two or more files into one.
  530. This is called |tconcatenation|t,  but it doesn't always  work quite right in
  531. all DOS versions.   Always take a look at the target file,  and make sure
  532. that  it does contain  each of  the source files,  before you  even think
  533. about deleting the source files!
  534.  
  535. Here are some examples of |nconcatenation|n:
  536.           |nCOPY|n FILE1 + FILE2 BIGFILE
  537.           |nCOPY|n FILE* BIGFILE
  538.           |nCOPY|n FILE1 + FILE2
  539. That last one  will use the first file specified,  FILE1,  as the target.
  540.                         <page down> for more COPY
  541. FILE2 will be appended  to the end of FILE1.   FILE1 will no longer exist
  542. in its original form, so be careful with that!
  543.  
  544. It's a good idea to make  a quick backup copy of each of the files you're
  545. about to concatenate, before you start.  Like this:
  546.           |nCOPY|n FILE* FILE*.BAK
  547.           |nCOPY|n FILE1 + FILE2
  548.  
  549. If the files you're trying to concatenate end with <Ctrl-Z>, which is the
  550. ASCII decimal 26,  or End-of-File character,  then the  TYPE command will
  551. show only the first source file  when you TYPE  the target file.   That's
  552. because  the TYPE command  stops when it finds the first <Ctrl-Z> charac-
  553. ter.   A lot of other sorts of programs do the same thing.   It will look
  554. as if the concatenation didn't work at all.  What to do about that?  Well
  555. you can use the  /A switch with  the |nCOPY|n command,  on the source side of
  556. the equation, as in |nCOPY|n FILE* /A BIGFILE.   This will cause the files to
  557. be copied up to, but not including, their first <Ctrl-Z> characters.  (If
  558. there's more  than one of these  characters in a file,  though,  whatever
  559. comes after the first one will be lost.)
  560.                         <page down> for more COPY
  561. The /A switch on the target side of the equation will cause a <Ctrl-Z> to
  562. be added to the end of the target file.
  563.  
  564. The /A switch  is the default for concatenation,  but only when DOS real-
  565. izes that concatenation is what's going on.  Sometimes you can trick DOS,
  566. you know.   So I just get  into the habit of using the /A even when it is
  567. the default,  just to make sure  DOS realizes that  I'm trying to do some
  568. concatenation.   There  are also  times when you want  DOS to use  the /A
  569. switch  when you're not  doing concatenation at all.   Like if you have a
  570. file  that has a  <Ctrl-Z> character  at the end,  and you want to remove
  571. that character, |nCOPY|n /A FILENAME.EXT FILENAME.NEW /B will do it.
  572.  
  573. There is  also a /B switch  for the |nCOPY|n command,  but it's not needed so
  574. often because it is the default  unless concatenation is being done.   On
  575. the source side,  it tells |nCOPY|n to copy the whole file,  according to the
  576. byte size listed in the file's directory entry, including, and past,  any
  577. <Ctrl-Z> characters that may be in the file.   On the target side, the /B
  578. switch causes a <Ctrl-Z> character to not be added to the end of the tar-
  579. get file.
  580.                         <page down> for more COPY
  581. An /A or /B switch applies to the file that precedes it,  and also to any
  582. files that follow it until the opposite switch is encountered.  So a com-
  583. mand like |nCOPY|n FILE1 /B + FILE2 + FILE3 /A + FILE4 /B BIGFILE would cause
  584. the /B switch  to apply to all the files except FILE3.   And |nCOPY|n FILE1 +
  585. FILE2 /B + FILE3 + FILE4 /A BIGFILE  would have the /A switch applying to
  586. FILE1, FILE4, and BIGFILE.
  587.  
  588. There is also a /V switch for the |nCOPY|n command, which tells DOS to VERIFY
  589. the copy.   But this doesn't do very much good,  and in fact if you use a
  590. disk cache, it doesn't do a bit of good because DOS will end up verifying
  591. the target file against the copy in the cache,  rather than verifying the
  592. target against the source file.  If you want to verify your copy, use the
  593. FC or COMP command instead, and see the VERIFY chapter for the reason.
  594.  
  595. Another use for the |nCOPY|n command  is to send or receive data to or from a
  596. device, instead of between two filenames.  For example, |nCOPY|n CON FILENAME
  597. will take data  from the keyboard  (the input half of the CON device) and
  598. send it to a file.   |nCOPY|n FILENAME /B CON will display a whole file, even
  599. the parts past the first End-of-File character, on the screen (the output
  600.                         <page down> for more COPY
  601. half of the CON device).   This is about  the only way you can display an
  602. entire .COM or .EXE file on the screen  with plain old DOS,  because most
  603. display methods stop at the first ^Z character,  since most display meth-
  604. ods think that's an End-of-File marker.
  605.  
  606. Another device  that's really useful  with the |nCOPY|n command is PRN.   You
  607. can  print out a file  with the command |nCOPY|n FILENAME PRN.   You can even
  608. use |nCOPY|n CON PRN to make your printer act sort of like a typewriter.
  609.  
  610. When copying from CON  to a filename or to PRN,  as soon as you enter the
  611. command,  the cursor moves down one line and over to the left edge of the
  612. screen,  and sits there waiting for you to type something.   You type the
  613. lines of text  that you want to send  to the file or to PRN,  hitting the
  614. <Enter> key after each line,  and when you're all done,  hit the <F6> key
  615. or the  <Ctrl-Z> keystroke combination,  hit <Enter>  one more time,  and
  616. your "file" will be copied to the disk or to the printer.  If anyone ever
  617. tells you to hit the <F6> key at the end of the last line, before hitting
  618. <Enter>, instead of hitting <F6> on a blank line of its own, don't do it.
  619. It'll work,  but it can also cause problems with that file in the future.
  620.                         <page down> for more COPY
  621. Another use for |nCOPY|n CON is to add text to the end of a text file without
  622. using a text editor.   |nCOPY|n CONFIG.SYS + CON  will allow you to add lines
  623. to the end of your CONFIG.SYS file,  as long as the last line that was in
  624. that file did not have a  <Ctrl-Z> character before its last carriage re-
  625. turn (<Enter> key).   That's just one example of the type of problem that
  626. can be caused by putting the <F6> before the <Enter>.   The <F6> key, you
  627. see, is what puts the <Ctrl-Z> at the end of a file.  You need to have an
  628. <Enter> at the end of the last line of the file before the <F6>/<Ctrl-Z>.
  629.  
  630. If you want to "move" some files instead of just copying them it's really
  631. sensible to always use the DIR command first,  to make sure the files you
  632. copied really made it to their destination,  before you delete the source
  633. files.   Suppose you give the command  |nCOPY|n *.* A:\TEMP to copy all files
  634. in the current directory  to the |nTEMP|n directory  in the root  of the disk
  635. in drive A:, and then DEL *.* to delete all the files in the current dir-
  636. ectory now that you have  copied them to A:\TEMP.   But guess what?   You
  637. had the wrong disk in the A: drive,  and it didn't have a directory named
  638. |nTEMP|n on it.   So now what you have  is a huge file named |nTEMP|n on the disk
  639. in drive A:, which is a concatenation of all those files that you thought
  640.                         <page down> for more COPY
  641. you just copied.   Well they're pretty useless now  (unless they were all
  642. solid ASCII text) and your source files  have already been deleted.   Too
  643. bad.   If you had done a  DIR A:\TEMP  command before deleting the source
  644. files, you would have seen that you had one huge file instead of the dir-
  645. ectory that you thought you had,  and you could have tried the |nCOPY|n again
  646. before you deleted the source files.
  647.  
  648. The |nCOPY|n command won't copy files that are 0 bytes long,  but XCOPY will.
  649.  
  650. If you want to change  the date and time  in a file's  directory entry to
  651. the |ncurrent|n date  and time  on your  system clock,  without  changing the
  652. file,  use the command |nCOPY|n FILENAME /B + ,, and the two commas will take
  653. the place of the second source file and the target file, the file will be
  654. copied to itself, the /B ensures that all of the file will be copied, and
  655. since DOS thinks  it's doing concatenation,  it updates the date and time
  656. of the file's directory entry.
  657.  
  658. If you copy a file  to a directory  where there is already  a file by the
  659. same name,  the file you're copying  will be copied right over top of the
  660.                         <page down> for more COPY
  661. one that was  already there,  because DOS  can only allow  one file  by a
  662. certain name in each  directory.   So before you  copy a file,  make sure
  663. you're  not going  to overwrite a file  that already exists  by that name
  664. in the target |sdirectory|s!   And this especially  applies to the use of the
  665. |nCOPY|n CON command!   So many people will advise you to use that command to
  666. write an  AUTOEXEC.BAT  or CONFIG.SYS file,  but they forget  to warn you
  667. that if you  already have a file by that name,  this command'll erase the
  668. old copy completely!
  669.  
  670. See the section on the RENAME command  for some information about how the
  671. meaning  of wildcards  differs slightly  between the source side  and the
  672. target side  of a command,  when you're copying files  to different names
  673. than what they had before.
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.                      <page down> for The |nCTTY|n Command
  681.                              The |TCTTY|T Command
  682.  
  683. I have no idea what that stands for, but I know what it does.   It trans-
  684. fers control  of your system  to some other device.   Like  if you have a
  685. second monitor  and keyboard connected  to your COM1 port  (also known as
  686. |sAUX|s), then you could give the command |nCTTY|n AUX and output would go to the
  687. second monitor,  and input would  be accepted  from the  second keyboard.
  688. Then when you're ready to go back to the main monitor and keyboard,  then
  689. on  the second keyboard  you type  |nCTTY|n CON  and that puts things back to
  690. normal.
  691.  
  692. Well the only use I've ever found for |nCTTY|n,  since I don't have any other
  693. monitors or  |skeyboard|ss hooked up,  is for cleaning up  the screen display
  694. during  execution  of a batch file.   If you have  a whole bunch  of COPY
  695. commands in a row in a batch file,  you get a screen that looks like this
  696. when you execute that batch file, even if ECHO is off:
  697.           1 file(s) copied
  698.           1 file(s) copied
  699.           1 file(s) copied
  700.                         <page down> for more CTTY
  701. Now who wants  to look at a screen  like that?   Not I.   If you're  very
  702. careful  and make sure you don't forget  the |nCTTY|n CON command at the end,
  703. you can put |nCTTY|n NUL at the beginning of the list of COPY commands in the
  704. batch file, like this:
  705.           |nCTTY|n NUL
  706.           COPY FILE1.TXT D:
  707.           COPY FILE2.TXT D:
  708.           (etc.)
  709.           |nCTTY|n CON
  710. If you forget  the |nCTTY|n CON  at the end there,  you'll be in big trouble.
  711. Because your computer is no longer accepting any input from the keyboard.
  712. You can't enter the  |nCTTY|n CON command  from the keyboard,  because DOS is
  713. only accepting input from the NUL device,  which doesn't even exist.   So
  714. don't forget the |nCTTY|n CON command.
  715.  
  716. Another  possible problem  with |nCTTY|n NUL,  is that it redirects  not only
  717. STanDard INput and STanDard OUTput, but also STanDard ERRor.  So even the
  718. error messages that would normally show on screen  will go to the NUL de-
  719. vice instead.   You won't know  if there have been any errors.   So don't
  720.                         <page down> for more CTTY
  721. use |nCTTY|n NUL unless you're sure  that the procedure that comes after that
  722. command will never cause any errors.  For example if you're copying files
  723. to a RAMdisk whose letter is D:,  you could use a command like IF NOT EX-
  724. IST D:\NUL GOTO END  to make sure that the RAMdisk  was properly created,
  725. before you use |nCTTY|n NUL and start copying.  (See the section on EXIST for
  726. details  on that command.)   And make sure that  there's no  possible way
  727. that the batch file  can possibly skip the |nCTTY|n CON command,  such as be-
  728. cause of a GOTO command or a syntax error.
  729.  
  730. Now if you ever need to use CON  while you're in the middle of a |nCTTY|n NUL
  731. section of a batch file, you don't have to do |nCTTY|n CON then do your stuff
  732. then do |nCTTY|n NUL again.  For example, if you need to use a PAUSE command,
  733. you can do it like this:
  734.           ECHO Don't even think about using Ctrl-C or Ctrl-Break > CON
  735.           ECHO Strike any key to continue. . . .  > CON
  736.           PAUSE < CON
  737. This method uses redirection  to send a message to the screen even though
  738. output has been redirected to NUL,  and the third line will accept a key-
  739. stroke from the keyboard  even though input  has been redirected  to NUL.
  740.                         <page down> for more CTTY
  741. Now if a body were to type the <Ctrl-C> or <Ctrl-Break> combination while
  742. PAUSE is waiting for a keystroke,  that would break out of the batch file
  743. so that the |nCTTY|n CON command would not get executed.  There's not a thing
  744. you can do when that happens,  except reboot.   Because the NUL device is
  745. never  going to send  the command  |nCTTY|n CON  to DOS,  and that's the only
  746. place DOS is accepting input from  while a |nCTTY|n NUL command is in effect.
  747. And don't be thinking  that you can use the command  BREAK OFF to make it
  748. impossible  for a user to press <Ctrl-Break>.   That command doesn't turn
  749. break checking off, it only makes it happen less often!
  750.  
  751. One more problem with this command,  is that it only works on STDIN, STD-
  752. OUT, and STDERR.   That means STanDard INput, STanDard OUTput, and STanD-
  753. ard ERRor.   Those are  the normal methods  that DOS uses  to communicate
  754. with  the CON devices  (monitor and |skeyboard|s).   Well there are many pro-
  755. grams that read  directly from the keyboard and/or write  directly to the
  756. video memory, and those programs will continue to use your normal CON de-
  757. vice rather than NUL  or AUX  or whatever you had redirected it to  using
  758. the |nCTTY|n command.  Because these programs are rude and bypass DOS to talk
  759. directly to the keyboard and video adapter.
  760.                 <page down> for The |nDATE|n and |nTIME|n Commands
  761.                         The |TDATE|T and |TTIME|T Commands
  762.  
  763. These commands are pretty straightforward.  If you enter the |nDATE|n command
  764. with no parameters, its output will look about like this:
  765.           |nCurrent|n date is Wed 06-19-1991
  766.           Enter new date (mm-dd-yy): _
  767. And it sits there waiting for you to either tell it the correct date,  or
  768. hit the <Enter> key  to accept the date  that is already there.   You can
  769. also enter the command  with a date,  as in |nDATE|n 06-19-91,  and that will
  770. just set the date and immediately give you a new prompt.
  771.  
  772. If you enter the |nTIME|n command with no parameters, here's the display:
  773.           |nCurrent|n time is 5:32:34.54p
  774.           Enter new time: _
  775. You can also enter  the new time  right on the command line,  as in  |nTIME|n
  776. 5:32p or |nTIME|n 17:32.   In most DOS versions, you can use a period instead
  777. of a colon to divide hours from minutes.  That's easier than messing with
  778. the <Shift> key to type a colon.  If you have DOS version 3.3 or earlier,
  779. you're on a  24-hour clock like the military uses,  instead of being able
  780.                     <page down> for more DATE and TIME
  781. to use a or p for a.m. or p.m.   So if it is after noon, you add 12 hours
  782. to the time.  For example, 6 p.m. is 18:00 on a 24-hour clock.
  783.  
  784. If your computer doesn't have an |ninternal|n battery-backed clock,  then you
  785. need to have the |nDATE|n and |nTIME|n commands in your AUTOEXEC.BAT file so that
  786. you'll have a chance to set the date and time  in DOS's system clock each
  787. time you reboot.   Otherwise your system clock will be  reset to 01-01-80
  788. and 12:00 or something like that.   Now whatever values are in DOS's sys-
  789. tem clock  (the name of which is |sCLOCK$|s)  are the values that will be put
  790. into the directory entries of every file that you update, and if the dir-
  791. ectory entries get the wrong values,  then an incremental BACKUP will act
  792. on the wrong files.   That's just one  of the very important  reasons for
  793. keeping  the right date and time in the system clock.   So without a bat-
  794. tery-backed clock, regardless of what a pain in the neck it is, you real-
  795. ly do need to have these two commands in your AUTOEXEC.BAT file.
  796.  
  797. If you boot from a disk that doesn't have an AUTOEXEC.BAT file on it,  or
  798. if that file is not in the root directory where DOS knows how to find it,
  799. then DOS will automatically execute  the |nDATE|n and |nTIME|n commands when it's
  800.                     <page down> for more DATE and TIME
  801. done |sboot|sing up.  If you do have an AUTOEXEC.BAT file, then DOS will only
  802. execute these two commands if they are included in that file.
  803.  
  804. If you have  DOS version 3.3 or later,  and a hardware clock whose memory
  805. address is the same as that used on true IBM brand computers, setting the
  806. date or the time  will automatically update  the battery-backed  hardware
  807. clock so that the values will still be correct the next time you boot the
  808. computer.   If you have an earlier  DOS version,  then you have a command
  809. file somewhere,  that came with your computer,  that allows you to change
  810. the date and time that's stored in the hardware clock,  because DOS won't
  811. do it for you.   Also it could be just a part of your CMOS setup,  if you
  812. don't have  any command file  for that purpose.   Of course,  ignore this
  813. paragraph if you don't even have a hardware clock.
  814.  
  815. If you want to display the date or time  without DOS stopping to wait for
  816. you to press <Enter> or enter a new value, it can be done.
  817.           VER || |nDATE|n
  818. will usually do it.   That's because the VER command sends a carriage re-
  819. turn (the <Enter> key) before it sends the version number so the carriage
  820.                     <page down> for more DATE and TIME
  821. return is  the first piece of output  that will be piped  as input to the
  822. |nDATE|n command, and since the |nDATE|n command only wants one piece of input in
  823. the first place,  the rest of  |sVER|s's output  won't affect anything.   The
  824. carriage return will go to the |nDATE|n command, which will have the same ef-
  825. fect as if  you had  hit the <Enter> key  from the  keyboard.   (See also
  826. redirection.)
  827.  
  828. A similar method  can be used to  enter the |ncurrent|n date  or time into an
  829. environment variable  for use in a batch file.   You'll need to write two
  830. batch files to make this work.  You might call the first one DATEVAR.BAT:
  831.           VER || |nDATE|n > HELLO.BAT
  832.           HELLO
  833. And the second batch file has to be named |nCURRENT|n.BAT:
  834.           SET DATE=%4
  835. Now what happens is  that the first command in  DATEVAR.BAT uses the same
  836. method as above  to display the |ncurrent|n date  on the screen without wait-
  837. ing for any input.   Only this time,  instead of the display going to the
  838. screen,  a file named  HELLO.BAT is created  which contains the output of
  839. the |nDATE|n command.  The next line of DATEVAR.BAT runs HELLO.BAT:
  840.                     <page down> for more DATE and TIME
  841.           |nCurrent|n date is Wed 06-19-1991
  842. Which runs |nCURRENT|n.BAT with  "date" as %1 and "is" as %2  and "Wed" as %3
  843. and "06-19-1991" as %4.  So the command inside |nCURRENT|n.BAT sets an envir-
  844. ment variable named |nDATE|n, equal to the |ncurrent|n date at the time this ser-
  845. ies of batch files was executed.   (See also redirection  and replaceable
  846. parameters.)
  847.  
  848. If you want to have  the |ncurrent|n time  displayed as part  of your prompt,
  849. can use  the $t prompt metacharacter  to do that,  but it will show you a
  850. time like 17:15:43.72  and you don't want to see that, right?   But there
  851. is also a $h metacharacter which is the <Backspace>.   So if you used the
  852. command  PROMPT $t$h$h$h$h$h$h$g,  that would give you the time,  and six
  853. backspaces,  and the > symbol,  so it would  look like 17:15>  instead of
  854. that ugly one  that included the seconds and hundredths of seconds.   And
  855. you can also use the $d prompt metacharacter, to give you the date.  When
  856. you have the time displayed in the prompt, it doesn't get updated contin-
  857. ually.   Whatever it says is what it's going to keep on saying, until the
  858. next time you hit the <Enter> key and a new, updated prompt is displayed.
  859.  
  860.                 <page down> for The |nDEL|n and |nERASE|n Commands
  861.                         The |TDEL|T and |TERASE|T Commands
  862.  
  863. These commands are interchangeable.   They are used to permanently remove
  864. any file from any disk.   Ok,  there are utilities  such as PC Tools that
  865. can undelete  a file,  and in DOS version 5.0  there is even  an UNDELETE
  866. command.   So deletion or erasure isn't always permanent.  If you realize
  867. right away that you made a mistake,  you can use  one of those utilities,
  868. or if you have DOS 5.0  you can use the UNDELETE command.   But if you do
  869. not realize  that you deleted the wrong file,  until you or  some program
  870. has written some information to the disk, then maybe that information got
  871. written right on top  of where that deleted file was,  and there's no way
  872. to get that file back then!  So you should always act like  |nDEL|n and |nERASE|n
  873. are permanent even though that's not exactly true.
  874.  
  875. The syntax is really easy.  |nDEL|n FILENAME.EXT or |nERASE|n FILENAME.EXT is all
  876. there is to it.   DOS version 4.0 or later adds a /P switch, which causes
  877. DOS to stop and ask if you're sure.   This is useful when you're deleting
  878. a group of files by using wildcards, because DOS will name each file that
  879. it's about to delete, and if there was one that you didn't want to delete
  880.                     <page down> for more DEL and ERASE
  881. you can say no.
  882.  
  883. If you have DOS version 4.0 or later  you should always use the /P switch
  884. if you're  using wildcards.   For earlier versions,  you should first use
  885. the DIR command  with the wildcard specification  you're planning to use,
  886. and it will show you the files that fit that wildcard spec.  If those are
  887. indeed the files that you want to delete,  then just type |nDEL|n and hit the
  888. <F3> key which will copy the wildcard specification  that you'd used from
  889. the template (DOS's |nmemory|n of the last command you entered) onto the cur-
  890. rent command line and you can execute the command without a chance of de-
  891. leting the wrong files.  (See also editing keys.)
  892.  
  893. You can also  use this command  to delete  all the files  in a directory.
  894. For recent versions of DOS,  you just use the directory name  in place of
  895. the filename.   For earlier versions, you use the *.* wildcard specifica-
  896. tion.   If your current directory  is C:\ and you want  to delete all the
  897. files in C:\WP\LTRS you can just enter the command |nERASE|n WP\LTRS or |nERASE|n
  898. WP\LTRS\*.*  and DOS will say  "Are you sure?"  and you say  "Y"  and all
  899. those files are gone.   DOS always asks if you're sure if you try to del-
  900.                     <page down> for more DEL and ERASE
  901. ete a whole directory worth of files all at once.   If you want to remove
  902. the directory after you have removed all the files from it, use the RMDIR
  903. command.
  904.  
  905. There are a couple of ways  to get around that question,  though.   Don't
  906. ever use  this method  without specifying  the complete  |spath|sname  of the
  907. files  in question,  because you might  accidentally erase  all the wrong
  908. files, but here it is:
  909.           ECHO Y || |nDEL|n C:\WP\LTRS\*.*
  910. The ECHO command sends the Y  and a carriage return  (the <Enter> key) to
  911. the |nDEL|n command by means of redirection  using the || symbol,  so when DOS
  912. asks you "Are you sure?" it finds that the "Y" is already waiting for it.
  913.  
  914. Another way is FOR %%a IN (C:\WP\LTRS\*.*) DO |nDEL|n %%a.   That method will
  915. work without even asking the question, because DOS won't realize that you
  916. have asked it to delete the whole directory at once.  It thinks it's del-
  917. eting one file at a time.
  918.  
  919. Just don't ever forget that if DOS asks you "Are you sure?" after you en-
  920.                     <page down> for more DEL and ERASE
  921. ter a |nDEL|n or |nERASE|n command,  that it's trying to tell you that it's about
  922. to delete every file from some directory or another.   If that's not what
  923. you had in mind, then say no and take another look at the command you had
  924. entered.
  925.  
  926. The |nDEL|n and |nERASE|n commands  don't actually do a thing  to the data in the
  927. files that they delete.   All they do is zero out  the first bytes of the
  928. directory and FAT entries for the files, so that DOS doesn't know they're
  929. there anymore.  The files are still on the disk, it's just that DOS can't
  930. find them.   That's why it is possible to UNDELETE them,  until such time
  931. as DOS uses that particular area of disk space  to store some other file,
  932. which overwrites the old deleted file and makes it totally unrecoverable!
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.                      <page down> for The |nDIR|n Command
  941.                              The |TDIR|T Command
  942.  
  943. This command is used to display  a DIRectory listing on your monitor.   A
  944. directory listing includes the name, extension,  size,  and date and time
  945. of last modification,  for each  file listed.   It also tells  the volume
  946. label of the disk, the name of the directory being listed,  the number of
  947. files and subdirectories displayed,  and the free space left on the disk.
  948.  
  949. The |nDIR|n listing does not include files which have their H or S attributes
  950. set to on, but it does work on files with R and A attributes.
  951.  
  952. You can display  the directory listing  for all the files  in the current
  953. directory,  by giving the command |nDIR|n all by itself,  with no parameters.
  954. You can see the listing for all the files  in some other directory by in-
  955. cluding  that |sdirectory|s's |spath|sname  on the command line,  as in |nDIR|n \DOS.
  956. You can see  the entries for the files  on a different disk  by including
  957. that disk's drive letter  as part of the command as in  |nDIR|n A:.   You can
  958. see the names of only the files that have a .COM extension, by typing |nDIR|n
  959. .COM, or just the files that start with the letter S by using |nDIR|n S*,  or
  960.                          <page down> for more DIR
  961. just about anything you want to do  by using the * and ? wildcards and/or
  962. the name of the drive and/or directory whose listing you want to display.
  963. (Notice those commas  are punctuation  in the sentence,  not part  of the
  964. commands.)   With the |nDIR|n command,  you don't have to always include both
  965. the filename and the extension of a group of files.  I mean if you wanted
  966. to do something like  COPY all the files that have a .COM extension,  you
  967. would have to say *.COM but if you just want a directory listing of those
  968. files, .COM will work.   The same way with all the files  that start with
  969. S, to copy them you would have to say S*.* but to get a directory listing
  970. of them, S* will work.
  971.  
  972. If you want to list the files that have no extension,  |nDIR|n *. will do it.
  973. If you just said |nDIR|n * then DOS would show you every file,  in the speci-
  974. fied directory, even those that have extensions.  But since *. includes a
  975. period, which is what separates filenames from their extensions, and then
  976. it doesn't have  anything after the period,  that tells |nDIR|n  to only show
  977. files that have blank extensions (which includes directory names).
  978.  
  979. If you see a line that says <DIR> on it,  in a directory listing, that is
  980.                          <page down> for more DIR
  981. a subdirectory entry.  You can see what files are in that subdirectory by
  982. issuing the command |nDIR|n NAME where NAME is the name of that subdirectory.
  983. If you are displaying  the listing for any directory  other than the root
  984. directory,  the first two entries will be . <DIR> and .. <DIR>.   See the
  985. section on ". and .." for an explanation of those lines.
  986.  
  987. Remember that if you're looking for a particular file,  it's a lot easier
  988. to issue the command  |nDIR|n FILENAME.EXT or  |nDIR|n FILE*.* than it is to just
  989. use the command |nDIR|n and scan all the filenames yourself  looking for that
  990. one file.  Let DOS do the work for you.
  991.  
  992. Although DOS displays  the filename,  and then one or more  blank spaces,
  993. and then the extension, that's not the format you want to use when you're
  994. trying to do  something  with a file.   When you use a filename in a com-
  995. mand, you type the filename,  then no spaces,  then the period,  then the
  996. extension.   That's the only way you'll get anything done in DOS, even if
  997. that's not the way DOS displays  the directory listing.   Really, though,
  998. it is more convenient the way DOS displays it.  It's just a lot easier to
  999. read a directory listing like that.  I've seen some file management util-
  1000.                          <page down> for more DIR
  1001. ities that display directory listings the way they have to be typed,  and
  1002. they're really hard to read.  Here's the difference:
  1003.  
  1004.           How |nDIR|n Displays Them:               How You Have to Type Them:
  1005.           COMMAND  COM                         |nCOMMAND.COM|n
  1006.           AUTOEXEC BAT                         |nAUTOEXEC.BAT|n
  1007.           CONFIG   SYS                         |nCONFIG.SYS|n
  1008.           DISKCOPY COM                         DISKCOPY.COM
  1009.           |nFORMAT|n   COM                         |nFORMAT|n.COM
  1010.           ANSI     SYS                         |nANSI.SYS|n
  1011.           |nATTRIB|n   EXE                         |nATTRIB|n.EXE
  1012.           SMARTDRV SYS                         SMARTDRV.SYS
  1013.  
  1014. You can  use redirection  to send  the output  of the |nDIR|n command  to the
  1015. printer, with |nDIR|n > PRN, or to a file, with |nDIR|n > FILE.EXT.  Of course be
  1016. aware that  if the file already exists,  that command  will delete every-
  1017. thing that's already in the file  and put the directory listing  in place
  1018. of it.   If you want  to add  the directory listing  to the end of a file
  1019. that already exists, use two > symbols, as in |nDIR|n >> FILE.EXT.
  1020.                          <page down> for more DIR
  1021. There are also two switches  you can use with the |nDIR|n command,  to modify
  1022. the command's operation a bit.   The /P switch will cause the |nDIR|n command
  1023. to only show you one screenful of data and pause,  and say "Press any key
  1024. to continue. . ." so that you can read what it says before it scrolls off
  1025. the screen.  Then when you "Press any key", the next screenful of info is
  1026. displayed, etc.
  1027.  
  1028. Then there is the /W switch, which will give you a wide display.  It will
  1029. not show you the size  or date and time of the files,  but will just dis-
  1030. play the filenames and extensions,  in five columns so that if you have a
  1031. directory  with a whole bunch  of files in it,  you might be able  to see
  1032. them all on the screen at once.
  1033.  
  1034. If you have a directory that's got  even more files than can be displayed
  1035. on one screen with the /W switch,  you can use the /P and /W switches to-
  1036. gether,  but you should seriously consider  dividing those files into two
  1037. or more subdirectories instead of leaving them all in one directory.
  1038.  
  1039. If you do not have  DOS version 5.0,  then skip the rest  of this section
  1040.                          <page down> for more DIR
  1041. except just  to see what you're missing.   One of the improvements in DOS
  1042. 5.0 is a whole lot of options for the |nDIR|n command.
  1043.  
  1044. First of all,  as well as the number  of files listed  and the free space
  1045. remaining  on the disk,  at the end of  the directory listing,  the total
  1046. number of bytes in the listed files is displayed.   But remember,  that's
  1047. not the amount of space those files use on the disk!  It's just the total
  1048. of what's in the size column for the filenames displayed.   The amount of
  1049. disk space used by those files will always  be higher than that,  because
  1050. of slack space.
  1051.  
  1052. Now the /W switch  causes the filenames  to be displayed  in the form you
  1053. have to type them in,  such as "CONFIG.SYS" instead of "CONFIG   SYS" the
  1054. way it worked in earlier versions.
  1055.  
  1056. Let's have a chart  of all the new DOS 5.0  |nDIR|n command switches now, be-
  1057. fore we get into serious explanations:
  1058.  
  1059.  
  1060.                          <page down> for more DIR
  1061.           /A attributes                   /O order for sorting
  1062.              A archive                       D date and time
  1063.              D directory                     E extension
  1064.              H hidden                        G group directories together
  1065.              R read-only                     N name
  1066.              S system                        S size
  1067.  
  1068.              /B bare display--(dirname and) filename.ext only
  1069.  
  1070.              /L lowercase dirnames and filenames
  1071.  
  1072.              /P pause display on each page (all DOS versions)
  1073.  
  1074.              /S subdirectories included
  1075.  
  1076.              /W wide display--five columns (all DOS versions)
  1077.  
  1078.  
  1079.  
  1080.                          <page down> for more DIR
  1081. The /A switch  will cause all filenames to be displayed,  even those with
  1082. Hidden and System attributes.   Or you could use  /AH to display only the
  1083. files that have the Hidden attribute set to on.  Or /A-A to show only the
  1084. filenames that  do not have  the A attribute.   Or  /AHR to show only the
  1085. files that have both the H and the R attributes.   Or /A-S-D to show only
  1086. the files that have neither the S attribute  nor the D (|sDirectory|s) attri-
  1087. bute.   (That's right, along with the A, H, R, and S attributes, there is
  1088. also the D one,  by which DOS tells files and directories apart, and this
  1089. can be accessed by DOS 5.0's new |nDIR|n command  although the ATTRIB command
  1090. still doesn't work with it.)   Or /AH-S to show only the files  that have
  1091. the H attribute but not the S attribute.
  1092.  
  1093. The /O switch  tells DOS  what order  you want the filenames  sorted into
  1094. each time  you see  the directory listing.   The sorting doesn't  seem to
  1095. slow DOS down,  so don't be shy  about using  this switch.   Without this
  1096. switch, DOS displays the filenames in the order that their entries happen
  1097. to reside in the directory.   With this switch you can display the direc-
  1098. tories  in alphabetical order  followed by  the filenames  in alpha order
  1099. (/O),  or all the filenames  and directory names  mixed together in alpha
  1100.                          <page down> for more DIR
  1101. order (/ON), or reverse alpha order (/O-N),  or all the files with no ex-
  1102. tensions followed by the directory names  followed by the files that have
  1103. extensions sorted by extension (/OE), or the /OE display in reverse order
  1104. (/O-E),  or all the files  and directories  mixed together  and sorted by
  1105. date and time,  from earlier  to later  (/OD),  or from later  to earlier
  1106. (/O-D),  or all the directories  in the order that they exist in the dir-
  1107. ectory followed by the filenames sorted by size  starting with the small-
  1108. est ones  (/OS),  or the opposite  of /OS--files sorted  from largest  to
  1109. smallest followed by the directories in directory order (/O-S), or final-
  1110. ly with the directories first in directory order followed by the files in
  1111. directory order  (/OG),  or files first  followed by directories,  all in
  1112. directory order (/O-G).
  1113.  
  1114. And of course you can use any combination of those /O switches.   For ex-
  1115. ample,  my favorite is  /OGEN which means  display the directories first,
  1116. followed by the filenames,  and sort the file extensions  in alpha order,
  1117. and within groups that have the same extension, sort those files by name.
  1118. (Having the same extension  also means all the files that have  no exten-
  1119. sion,  and that includes directory names,  so the directory names do also
  1120.                          <page down> for more DIR
  1121. get sorted  in alpha  order  with that switch.)   The switch  combination
  1122. /OD-S  would mean to sort the files  by date and time,  but within groups
  1123. that have the same  date and time,  sort those files by size,  in reverse
  1124. order meaning from largest to smallest.   (If you created all your direc-
  1125. tories at  the same time,  then they will appear  together  in a group in
  1126. this listing,  but they won't be sorted  in any particular order  because
  1127. they all have  a size of zero.   But if you add  an N to that switch com-
  1128. bination, making it /OD-SN, then the directory names,  or any other group
  1129. of files that have matching dates,  times,  and sizes,  will be sorted in
  1130. alpha order by name.)
  1131.  
  1132. The /S switch tells DOS to show you a directory listing for the specified
  1133. directory,  followed by the listings  for each and every  subdirectory of
  1134. the specified directory,  and every subdirectory of those subdirectories,
  1135. etc.   If the specified directory  is the root,  then this will  give you
  1136. every filename  on the entire disk.   If you combine  this switch  with a
  1137. filename  or a wildcard specification,  such as  |nDIR|n *.BAT /S,  you would
  1138. find every file on the disk  that has the specified filename.   Or if you
  1139. combine the /S with the /A,  as in  |nDIR|n /AH /S,  that will show you every
  1140.                          <page down> for more DIR
  1141. file on the disk that has its Hidden attribute set to on.
  1142.  
  1143. The /B switch just gives you the filename-period-extension,  with no vol-
  1144. ume label, no total number of bytes, no file sizes or dates,  nothing ex-
  1145. cept the name, for all the files.  If you combine it with the /A-D switch
  1146. to exclude  the directory  names,  this is  really useful  for creating a
  1147. batch file or text file  of all the files in a directory.   |nDIR|n /B /A-D >
  1148. FILE.BAT will do it automatically.   And if you add the /S switch, you'll
  1149. get all  the specified files  in the specified directory  and all of  its
  1150. subdirectories,  and in that case the display will include the full |spath|s-
  1151. name for  each file listed,  so that you will know  which file  came from
  1152. what directory.
  1153.  
  1154. The /L switch  will convert  all the letters  in the directory names  and
  1155. filenames to lowercase.
  1156.  
  1157. Now another great feature of the DOS 5.0 |nDIR|n command, is that you can set
  1158. an environment variable called  |TDIRCMD|T to tell DOS what switches you want
  1159. to use as the default.   Normally the default  is no switches,  so if you
  1160.                          <page down> for more DIR
  1161. type |nDIR|n by itself,  you get the display that you would get if you hadn't
  1162. entered any switches on the command line,  right?   Not anymore.   If you
  1163. put the line SET |sDIRCMD|s=/OGEN /P into your AUTOEXEC.BAT file,  then every
  1164. time you issue the |nDIR|n command,  DOS will see in the environment that you
  1165. want to use the  /OGEN and  /P switches as the default,  and you will get
  1166. that display every time.   Now if you want to see, just this once, a dir-
  1167. ectory listing  that is not sorted  in any way,  you can enter |nDIR|n /-O to
  1168. tell DOS  that you want to  temporarily ignore the  /OGEN switch that you
  1169. have as your default in the DIRCMD environment variable.   Of course like
  1170. any other  environment variable,  you can change it  at any time by using
  1171. the SET command,  or by editing the  SET DIRCMD line in your AUTOEXEC.BAT
  1172. file and |sreboot|sing.
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.                    <page down> for |nDirectory|n Structure
  1181.                            |tDirectory|t Structure
  1182.  
  1183. A |ndirectory|n is like a Table of Contents that tells DOS where to find each
  1184. file  on the disk.   But a directory's size  is set at the time a disk is
  1185. formatted, and cannot be enlarged.   A |ndirectory|n on a hard drive can only
  1186. contain 512 entries.   If you try to add another file to a |ndirectory|n that
  1187. is already full,  you'll get a  "|sdisk full|s" message.   Well surely a hard
  1188. disk can hold more than 512 files?
  1189.  
  1190. Yes, it can,  by putting subdirectory names in place of some of the file-
  1191. names in the |ndirectory|n.   Subdirectories  can have a number  of files  or
  1192. other subdirectories  in them that is limited only by  the amount of disk
  1193. space.   A subdirectory listing is just like any other file;  if the file
  1194. or the listing  gets larger,  it simply gets  more space allocated to it.
  1195. Only the root |ndirectory|n is limited in size.
  1196.  
  1197. There are also  other reasons  for breaking  the files up  into groups in
  1198. subdirectories, rather than leaving them all in the root |ndirectory|n.   For
  1199. one thing, if you actually had 512 files in your root |ndirectory|n, wouldn't
  1200.                       <page down> for more Directory
  1201. it be  awfully hard to see what's there,  with all those other  filenames
  1202. getting in the way?  Well it's hard for DOS to find a file that way, too.
  1203. DOS has to look through  the entire |ndirectory|n listing,  just like you do,
  1204. to find a file that you tell it to find.  So it's best to keep large pro-
  1205. grams,  that include many files,  each in their own subdirectory, so that
  1206. both you and DOS can find them more quickly.  MKDIR is the command that's
  1207. used to make directories and subdirectories.
  1208.  
  1209. The easiest way to visualize a |ndirectory|n structure,  is like a file room.
  1210. The |troot|t |ndirectory|n  (the main |ndirectory|n which  covers the contents of the
  1211. entire disk)  is like the fileroom.   There are a bunch of file cabinets,
  1212. and a few separate file folders  laying around  that have not been placed
  1213. into the cabinets.  The file cabinets are like subdirectories.  Each sub-
  1214. |ndirectory|n  can contain  further subdirectories.   These would be like the
  1215. drawers in the file cabinets.   The drawers contain the files,  just like
  1216. subdirectories contain files.
  1217.  
  1218. The |tcurrent|t |ndirectory|n  is like  whichever  file cabinet  or drawer DOS is
  1219. currently sitting in.   To CHange the |ncurrent|n |nDIRectory|n, you use the com-
  1220.                       <page down> for more Directory
  1221. mand |TCHDIR|T, which can be abbreviated as |TCD|T.  The current |ndirectory|n's also
  1222. called the |tdefault|t |ndirectory|n.  A |ndefault|n just means whatever will be used
  1223. as parameters if the parameters are not specified.
  1224.  
  1225. The terms  current and  |ndefault|n can also apply to drives,  and have about
  1226. the same meanings when they do.  The current drive is the one whose drive
  1227. letter is shown in your prompt.   But the current |ndirectory|n is not always
  1228. the same as the current drive.   Each drive on your system  has a current
  1229. |ndirectory|n at all times, even when that drive is not the current one.  The
  1230. current |ndirectory|n,  on a drive that is not current, is the |ndirectory|n that
  1231. would be current if that drive were made current.   Unless you change the
  1232. current |ndirectory|n on a disk, it is the root |ndirectory|n.  Each time you re-
  1233. boot your system, the root |ndirectory|n of each drive is the current one.
  1234.  
  1235. You can even use  the |nCHDIR|n or |nCD|n command to change the current |ndirectory|n
  1236. on a drive other than the current one.   For example, the |nCD|n C:\UTIL com-
  1237. mand will change  the current |ndirectory|n on drive C: to \UTIL,  whether C:
  1238. is the current drive or not.  And the command |nCD|n with no parameters, will
  1239. show you what your current drive and |ndirectory|n are.
  1240.                       <page down> for more Directory
  1241. The way to change the current drive is quite simple.  To make C: the cur-
  1242. rent drive,  the command is just |TC|1:|T.   To make A: the current drive,  the
  1243. command  |TA|1:|T  would do it.   There is no way in DOS  to change the current
  1244. drive,  and the  current |ndirectory|n  on that drive,  all in one step.   It
  1245. takes a C:, A:, etc. type of command as well as a CHDIR or CD command.
  1246.  
  1247. Another way  to visualize  a |ndirectory|n structure  is like  an upside-down
  1248. tree.   The root |ndirectory|n  is the trunk of the tree,  the subdirectories
  1249. are the main branches,  which can be further divided into smaller branch-
  1250. es, and the leaves are the files.
  1251.  
  1252. The |tparent|t of the current |ndirectory|n  is the one that's next closer to the
  1253. root.   If the current |ndirectory|n is a second-level subdirectory, then the
  1254. |nparent|n is the first-level subdirectory immediately above it in the upside
  1255. down tree.   If the current |ndirectory|n is a first-level subdirectory, then
  1256. the |nparent|n is the root |ndirectory|n.
  1257.  
  1258. Referencing all these  different drives  and directories  is not all that
  1259. difficult.  To tell DOS what disk you're talking about, you use the drive
  1260.                       <page down> for more Directory
  1261. letter followed by a colon,  as in C:.   Then you start out  with a back-
  1262. slash.   A leading backslash  always refers to  the root |ndirectory|n of the
  1263. disk in question.  Then you tell the subdirectory names, in order, start-
  1264. ing from the root, that lead to the file.  Each subdirectory name is sep-
  1265. arated from the others by another backslash.  Then you tell DOS the file-
  1266. name, a period, and the filename extension.   |nDirectory|n names can be from
  1267. one to eight characters, and filenames are the same.  The filename exten-
  1268. sion can be from zero to three characters.  So, a full filename specific-
  1269. ation might look like this:
  1270.           C:\WORD\LETTERS\FILENAME.EXT
  1271.  
  1272. Of course,  it's best if you use really short words  or abbreviations for
  1273. your |ndirectory|n names,  because that will save you  a whole lot  of typing
  1274. over the years.   Also,  the PATH variable in the environment can only be
  1275. 127 characters long,  so if your |ndirectory|n names are long, you'll only be
  1276. able to fit a few of them into that variable.
  1277.  
  1278. DOS can tolerate  a lot of  shortcuts  when dealing  with file specifica-
  1279. tions.  Anything that is the default can be left out.   Suppose your cur-
  1280.                       <page down> for more Directory
  1281. rent drive is C:  and the current |ndirectory|n  on C: is \DOS.   If you want
  1282. to refer  to the file  C:\UTIL\FOO.BAR,  you can  just say  \UTIL\FOO.BAR
  1283. because if  you leave out  the drive letter,  DOS will assume the current
  1284. drive, and in this case that's the drive you wanted anyway.
  1285.  
  1286. If your  current drive  is still C:  and the current |ndirectory|n  on the A:
  1287. drive is  \GAMES  and you want to reference  the file  A:\GAMES\PLAY.EXE,
  1288. then all you need to tell DOS is A:PLAY.EXE, because if you leave out the
  1289. |ndirectory|n,  DOS will assume the current |ndirectory|n on the drive mentioned,
  1290. which is the right one.  However, if you put a leading backslash in there
  1291. as in A:\PLAY.EXE,  that wouldn't work because a leading backslash always
  1292. refers to  the root |ndirectory|n,  and PLAY.EXE is not in the root,  it's in
  1293. the GAMES subdirectory which branches from the root.
  1294.  
  1295. Now suppose your current drive  is still C: and drive C:'s current direc-
  1296. tory is still \DOS, and you want to refer to the file C:\DOS\GO.EXE, then
  1297. all you have to say is GO.EXE because C: and \DOS\ are both the |sdefault|ss.
  1298.  
  1299. Now let's say the current drive is C: and the current |ndirectory|n is \ (the
  1300.                       <page down> for more Directory
  1301. |sroot|s)  and we want to tell DOS about that same file  named C:\DOS\GO.EXE.
  1302. This time,  we can still leave out the C:  and also the leading \ because
  1303. those are the |sdefault|ss, and we can say DOS\GO.EXE.
  1304.  
  1305. If the current |ndirectory|n were \UTIL instead then we would have to include
  1306. the \ to remind DOS  to start back up in  the root |ndirectory|n again,  then
  1307. look for the |ndirectory|n named DOS which is branching from a different spot
  1308. in the root.
  1309.  
  1310. Now how about the ". and .." directories that show up  in every |ndirectory|n
  1311. listing except the |sroot|s?   The .. entry stands for  the parent |ndirectory|n.
  1312. Well suppose that  the current drive is C:  and the current  |ndirectory|n is
  1313. \WORD\LETTERS\JOHN and we want to tell DOS to do something with a file in
  1314. a |ndirectory|n called C:\WORD\LETTERS\BILL.   How do we do that?   Well,  we
  1315. have to first  go up one level  in the upside-down tree  to LETTERS,  and
  1316. then down one level to BILL.  This will look pretty complicated at first,
  1317. but believe me,  when you get used to it,  it will be easier  than typing
  1318. out the whole name, C:\WORD\LETTERS\BILL\FILENAME.EXT.   Here's the short
  1319. way:   ..\BILL\FILENAME.EXT.   If it weren't for the .. symbol that takes
  1320.                       <page down> for more Directory
  1321. us up one level,  then the shortest way  to do it would have been  \WORD\
  1322. LETTERS\BILL\FILENAME.EXT.  So, even though the .. symbol will take a bit
  1323. of getting used to, it's worth it!
  1324.  
  1325. If you don't have a hard drive,  you might think  that you will  never be
  1326. interested in directories.   Guess again!   Remember that the root direc-
  1327. tory of any disk is limited as to how many entries it can hold.  For 360K
  1328. and 720K disks, that limit is 112 files, and for 1.2M and 1.44M disks, it
  1329. is 224.   If you want to have more files than that on a disk, you have to
  1330. create a subdirectory  on the disk  to put the files  into.   Because al-
  1331. though the root |ndirectory|n  is of a limited size,  a subdirectory can con-
  1332. tain an unlimited number of files.
  1333.  
  1334. If you have more than 150 files in any |ndirectory|n,  you should divide that
  1335. |ndirectory|n into subdirectories, so that DOS can find your files faster.
  1336.  
  1337. Now remember that even though it's easier for you to think of directories
  1338. in terms of file rooms, and upside-down trees, and stuff,  in reality all
  1339. they are is files.   They're just files  which contain  information about
  1340.                       <page down> for more Directory
  1341. other files.  For example here's the |ndirectory|n entry for my AUTOEXEC.BAT:
  1342.           41 55 54 4F 45 58 45 43 42 41 54 00 00 00 00 00
  1343.           00 00 00 00 00 00 89 BE DC 16 6C 01 5D 03 00 00
  1344. The eleven bytes  starting with 41, 55, 54,  if you look those up  in the
  1345. hexadecimal column of the ASCII chart,  you'll find that they spell AUTO-
  1346. EXECBAT.  (If the filename were less than eight letters long, there would
  1347. be one or more 20s between the name and extension  of the file because 20
  1348. is hex for 32, which is the <Space>.)   The next number is the attributes
  1349. byte,  and since it says 00,  you know that this file doesn't have any of
  1350. its attributes turned on.   The four bytes  89, BE, DC, 16,  are the date
  1351. and time of the most recent update to the file.   The bytes 5D 03 are the
  1352. size of the file  (the number of bytes  in length).   It's in  the format
  1353. least-significant-byte-then-most-significant-byte, which is a really con-
  1354. fusing thing that computers do a lot, so really the file size is 035D in-
  1355. stead of 5D03,  and 035D in hex is 861,  so my AUTOEXEC.BAT file  at that
  1356. time was  861 bytes long.   Also in the |ndirectory|n entry  is the number of
  1357. the first cluster of the file  (where it's located on the disk).   I sup-
  1358. pose that must be the bytes 6C 01 since those are the only non-zero bytes
  1359. left that aren't accounted for.
  1360.                       <page down> for more Directory
  1361. Well,  a |ndirectory|n is just a file that holds  an entry like that for each
  1362. file in the |ndirectory|n.  A |ndirectory|n can be fragmented just like any other
  1363. file,  and everything.   The only thing that makes it different  from any
  1364. other file,  is that it has its D attribute turned on,  so that DOS won't
  1365. let us  treat it like  a normal  file.   If you try to treat  a |ndirectory|n
  1366. like a file, the result is often "|sAccess denied|s".
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.              <page down> for The |n". and .."|n |nDirectory|n Entries
  1381.                      The |T". and .."|T Directory Entries
  1382.  
  1383. What on earth are these things?   They appear at the top  of every direc-
  1384. tory on my hard drive, except the root |sdirectory|s!   What are they?  The .
  1385. stands for the current directory, and the .. stands for the parent direc-
  1386. tory.   You can use them  as a form of shorthand.   If you want to delete
  1387. every file in the current directory, you can type:
  1388.           DEL *.*
  1389. or you can save typing those bothersome asterisks by typing:
  1390.           DEL .
  1391. with the same results.
  1392.  
  1393. Suppose you're in a subdirectory of a subdirectory of (etc.) named
  1394.           C:\WP\LETTERS\OCT1990\JOHN
  1395. and you want to change  to the directory C:\WP\LETTERS\OCT1990.   You can
  1396. either type
  1397.           CD C:\WP\LETTERS\OCT1990
  1398. or,  since .. stands for  the parent directory  of the current directory,
  1399. you can just type:
  1400.                      <page down> for more ". and .."
  1401.           CD ..
  1402. with the same  results!   Won't that save  a few thousand  keystrokes per
  1403. year?   Actually you don't even need  the space in there,  you could type
  1404. CD.. just as well.
  1405.  
  1406. And remember,  when the DOS manual says that you can't remove a directory
  1407. until it is empty, it really means until it is empty of everything except
  1408. the . <DIR> and .. <DIR> entries!  Don't ever try this:
  1409.           DEL ..
  1410. to empty your directory in preparation for the RMDIR command,  since what
  1411. that command will do is delete every file in the parent |sdirectory|s!
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.                     <page down> for The |nMKDIR|n Command
  1421.                             The |TMKDIR|T Command
  1422.  
  1423. This  command is used to  MaKe a new DIRectory.   It can also be abbrevi-
  1424. ated as |TMD|T.   The syntax is just  |nMKDIR|n D:\DIR\NAME where D: is the drive
  1425. you want to put the new directory on,  and |nDIR|n  is the directory you want
  1426. to put the new directory under.  Of course whatever parts of that command
  1427. are the |sdefault|ss, you can leave out.  Some examples:
  1428.           |nMKDIR|n C:\WORD\DOCS
  1429. would make a directory named DOCS underneath the WORD directory on the C:
  1430. drive.
  1431.           |nMKDIR|n \WORD\DOCS
  1432. would make a directory  named DOCS  under the WORD directory  on whatever
  1433. drive is current at the time.
  1434.           |nMKDIR|n DOCS
  1435. would make a directory named DOCS under the current directory of the cur-
  1436. rent drive.   If the current directory of the current drive were C:\WORD,
  1437. then the above three commands would all do the exact same thing.
  1438.           |nMKDIR|n \DOCS
  1439. makes a directory named DOCS  in the root directory of the current drive.
  1440.                         <page down> for more MKDIR
  1441. The longest |spath|sname you're allowed to have is 63 characters, so keep the
  1442. names short.   For example, instead of a name like WORDPROC for your word
  1443. processor, use WP or WORD.   That way, if your subdirectories end up very
  1444. deeply nested, you won't exceed the 63-character limit.   Then again, you
  1445. probably  won't want to make  any subdirectories  more than three or four
  1446. directories deep anyway.
  1447.  
  1448. When I say "the longest |spath|sname you're allowed",  that has nothing to do
  1449. with the  PATH command  or the PATH  environment variable.   It means the
  1450. path that DOS follows to find one file.  For example, you can have a sub-
  1451. directory named \DOS\UTIL\COMP\PK\PKZIP\PROGS\HOLD\TEMP\NOW,  but you can
  1452. not have one with this name:
  1453.      \DOS50\UTILITIES\COMPRESS\PKWARE\PKZIP\PROGRAMS\HOLDING\TEMPORAR\NOW
  1454. because that's longer than 63 characters!
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.                     <page down> for The |nRENAME|n Command
  1461.                             The |TRENAME|T Command
  1462.  
  1463. This command can be abbreviated as |TREN|T.   In fact, many people don't even
  1464. realize that |nRENAME|n is a valid command;  they think that |nREN|n is the whole
  1465. command, not its abbreviation.
  1466.  
  1467. It is used to give a file a different name from the name it has now.  The
  1468. syntax is really easy.
  1469.           |nRENAME|n D:\DIR\FILENAME.EXT FILENAME.EXT
  1470. Of course if the file  is in the current directory  of the current drive,
  1471. you can leave out the D:\DIR\ part.  But you can't specify a |spath|sname for
  1472. the second filename,  since you can't rename a file to a different place.
  1473. (For that you want the COPY command.)
  1474.  
  1475. You could also do something like rename all your  .TXT files to have .DOC
  1476. extensions, all in one command, like this:
  1477.           |nRENAME|n *.TXT *.DOC
  1478. Notice that wildcards on the target side of the equation have a different
  1479. meaning than wildcards on the source side.   *.TXT means "every file that
  1480.                        <page down> for more RENAME
  1481. has a .TXT extension", but *.DOC means "the same first name as the source
  1482. files but with the extension .DOC".  It won't do a thing to any files you
  1483. might already have with .DOC extensions.  On the target side of the equa-
  1484. tion,  wildcards just tell DOS  to leave this part  the same as it was on
  1485. the source side.  So you could say |nRENAME|n CONFIG.SYS *.BAK to save typing
  1486. the word CONFIG twice.  The same rule applies to any command that can use
  1487. wildcards on the target side of an equation.
  1488.  
  1489. If you try  to rename a file  to a name that some other file  in the same
  1490. directory already has,  you'll get a  "Duplicate filename" error message.
  1491. You can't do that.   Every file in a directory has to have its own unique
  1492. name.   Either delete the file  that already has  that name,  or COPY the
  1493. source file  over top of it,  or else choose a different name and try the
  1494. |nRENAME|n command again.
  1495.  
  1496. If you ever give a file  a name with a <Space> in it,  like FILE ONE.TXT,
  1497. you won't be able to do anything with that file.  DOS doesn't allow spac-
  1498. es in filenames,  so it won't let you delete or anything else,  with such
  1499. an invalid name.   But you can use a |nRENAME|n command with wildcards to fix
  1500.                        <page down> for more RENAME
  1501. that problem right up.   |nRENAME|n FILE?ONE.TXT FILEONE.TXT will do it,  be-
  1502. cause the  ? wildcard stands for  "any character in  this position of the
  1503. filename" so that will take care of the <Space>.   And now the file has a
  1504. valid name, so you can do whatever you want with it.
  1505.  
  1506. If you have a filename that's so badly garbled  (probably because of mag-
  1507. netic damage  to the directory entry)  that the ?  wildcard method  won't
  1508. work, try this one:
  1509.           XCOPY *.* NEWNAME /P
  1510. Now the /P switch will cause the XCOPY command to stop and ask you before
  1511. it copies each file,  so you want to  say no to all the files  except the
  1512. damaged filename.   The file with the damaged name  will be copied to the
  1513. NEWNAME file, and then if you have DOS version 4 or later (don't even try
  1514. this if you don't have version 4,  because the /P switch didn't exist for
  1515. the DEL command before that),  you can use the same trick with DEL *.* /P
  1516. and say no to every file except the funky one.   There, now the bad file-
  1517. name is gone  and the file  is still there,  under the new name.   If you
  1518. have more than one filename that's  damaged like that,  you have to start
  1519. up the  XCOPY command again  and this time  say something like  XCOPY *.*
  1520.                        <page down> for more RENAME
  1521. NEWFILE2 /P,  because you  won't be able to  copy any other files  to the
  1522. NEWNAME filename  without overwriting  the one you just  created  by that
  1523. same name.  You'll have to specify another target filename.
  1524.  
  1525. You can rename  all your external DOS commands  (the ones that  have disk
  1526. files, that are not stored inside the COMMAND.COM file) to whatever names
  1527. you want them  to have.   You can  |nRENAME|n |nFORMAT|n.COM FORM.COM  to make it
  1528. shorter to type,  or you can  |nRENAME|n |nRECOVER|n.COM BAD.COM  so you remember
  1529. not to use it.   But if you do any renaming of commands, just remember if
  1530. any other program or batch file calls them, it won't be able to find them
  1531. under the new names,  because it's still looking for the old names.   For
  1532. batch files,  that's easy to fix;  just edit the file and replace the old
  1533. command name with the name  that you changed it to.   Another reason this
  1534. can give you trouble,  is that if you go over to a friend's house to help
  1535. him with his computer,  and you go to format a disk and you type  FORM A:
  1536. because that's what you're used to on your computer,  well of course your
  1537. friend's FORMAT command is still named |nFORMAT|n.COM and your friend's going
  1538. to think you're not as smart as you think you are, because you'll get the
  1539. "|sBad command or filename|s" message.
  1540.                     <page down> for The |nRMDIR|n Command
  1541.                             The |TRMDIR|T Command
  1542.  
  1543. This command can also be abbreviated as |TRD|T.   What it does,  is to ReMove
  1544. any completely empty DIRectory.   Before you can remove a directory,  you
  1545. must remove  all subdirectories from it  (except the ". and .." entries),
  1546. as well as all the files.
  1547.  
  1548. The main problem with removing directories  is that sometimes a directory
  1549. will contain files which have their  Hidden, System, or Read-only attrib-
  1550. utes turned on.   These files must first be deleted, but in order to del-
  1551. ete them, those attributes must be removed with the ATTRIB command.
  1552.  
  1553. Another problem  with removing directories  is that you cannot remove the
  1554. current directory.  You must change to a different directory first, using
  1555. the CHDIR command.
  1556.  
  1557. See the section on the MKDIR command for the syntax of this one, since it
  1558. is just the same.
  1559.  
  1560.                    <page down> for The |nTRUENAME|n Command
  1561.                            The |TTRUENAME|T Command
  1562.  
  1563. This is an undocumented command, which means two things.  First, it means
  1564. that it's not mentioned in the manuals.   Second, it means that Microsoft
  1565. is not promising  to keep supporting this feature  in later DOS versions.
  1566. They might leave it in, or they might not.   And it could, possibly, also
  1567. mean that the command doesn't always work right.
  1568.  
  1569. Well the command made its first appearance in DOS version 4, and its pur-
  1570. pose is,  as its name implies,  to tell you the actual name of a drive or
  1571. directory  that is currently  being disguised  as some different drive or
  1572. directory, via the ASSIGN, JOIN, or SUBST commands.
  1573.  
  1574. For example,  if you have used the SUBST command to pretend that the dir-
  1575. ectory D:\WORD\DOCS is the E: drive,  then if you say |nTRUENAME|n E: it will
  1576. tell you D:\WORD\DOCS.  You can also use this command with no parameters,
  1577. and it will tell you the true name of the current drive and directory, or
  1578. with a drive and |spath|sname, or with a filename, or whatever.
  1579.  
  1580.                      <page down> for The |nTYPE|n Command
  1581.                              The |TTYPE|T Command
  1582.  
  1583. This command is pretty much  straightforward.   It just types a disk file
  1584. to the screen where you can look at it.   Or you can  use it  with output
  1585. redirection to send a copy of the file to your printer, or to a different
  1586. filename.
  1587.  
  1588. If the file is so long  that it won't all fit on the screen at once,  you
  1589. can stop the display from scrolling with the  <Ctrl-S>  keystroke combin-
  1590. ation, or the <Pause> key if you have one.   Or you can use the MORE fil-
  1591. ter with redirection, or you can just use the MORE command instead of the
  1592. |nTYPE|n command if you're really careful about using the < symbol instead of
  1593. the > symbol!
  1594.  
  1595. One big problem  with the |nTYPE|n command  is that  if you use it on  a file
  1596. that has a  ^Z (End-of-File) character inside it,  |nTYPE|n will think that's
  1597. the end  of the file,  and won't display  another byte of it.   So if you
  1598. think that the file concatenation you just tried didn't work, it could be
  1599. that it worked just fine,  only one of the first files  in the concatena-
  1600.                         <page down> for more TYPE
  1601. tion had a  ^Z at the end of it,  so the |nTYPE|n  command won't display  the
  1602. other files  that you  concatenated  onto the end  of that one.   They're
  1603. there,  but you just can't  see them with the |nTYPE|n command.   You can see
  1604. them, though, with the command  COPY /B FILENAME.EXT CON because the COPY
  1605. command with the  /B switch  will look in the file's  directory entry and
  1606. see  how many bytes long  the file is,  and copy all those bytes  without
  1607. paying any attention to whether there are any ^Z characters in there.
  1608.  
  1609. Most .COM and .EXE files  have ^Z (End-of-File)  characters and ^G (Bell)
  1610. characters in them,  so if you use the |nTYPE|n command on one of these,  you
  1611. will hear a beep each time  you reach a ^G character,  and then the first
  1612. time you reach a ^Z character,  the |nTYPE|n command will just stop  and give
  1613. you back your DOS prompt.
  1614.  
  1615. Another use for the |nTYPE|n command  is if you have a batch file where you'd
  1616. like  to display a bunch  of lines of messages  to the screen all at once
  1617. from within  that batch file.   You could use  a whole bunch of ECHO com-
  1618. mands, but that would be really slow since DOS reads each line of a batch
  1619. file from the disk,  executes that command, reads the next line, etc.   A
  1620.                         <page down> for more TYPE
  1621. faster way would be to make an ASCII file  that contains just those mess-
  1622. ages that you want displayed, and perhaps name that file MESSAGES.TXT and
  1623. put it in your BELFRY directory  (because that's where .BATs belong)  and
  1624. then instead of putting all those ECHO commands into the batch file, just
  1625. put the command  |nTYPE|n C:\BELFRY\MESSAGES.TXT in there instead.   But then
  1626. if you give a copy  of that batch file to a friend,  don't forget to give
  1627. him the MESSAGES.TXT file too.
  1628.  
  1629. Anyway,  the syntax for this command  is just about as simple as it could
  1630. be, just the word |nTYPE|n followed by the filename and extension of the file
  1631. you want to display on your screen.   And of course if the file is not in
  1632. the current directory of the current drive, then you tell DOS where it is
  1633. by including the entire |spath|sname for the file.  Some examples:
  1634.           |nTYPE|n CONFIG.SYS
  1635.           |nTYPE|n A:|nCONFIG.SYS|n
  1636.           |nTYPE|n C:\CONFIG.SYS
  1637.           |nTYPE|n C:\DOS\BAK\CONFIG.BAK
  1638.  
  1639. The worst thing  about the |nTYPE|n command is that it only goes one way.   I
  1640.                         <page down> for more TYPE
  1641. mean if you want to go back  and look at an earlier part of the file that
  1642. has already scrolled off the screen, you have to BREAK out of the command
  1643. with the  <Ctrl-C> keystroke combination,  and use the <F3> key to repeat
  1644. the  same |nTYPE|n command again,  and start over from the beginning.   There
  1645. are lots of little public domain utilities  such as BROWSE.COM,  that you
  1646. can  download  from your local  BBS,  that let you use  the <PageUp>  and
  1647. <PageDn> keys to go to whatever part of the file you want to look at.
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.                      <page down> for The |nVER|n Command
  1661.                              The |TVER|T Command
  1662.  
  1663. This command  is super simple  to explain,  but then again  it doesn't do
  1664. anything useful, either.  It just tells DOS to show you the name and num-
  1665. ber of the DOS version you're running.  It might look like this:
  1666.           C:\>VER
  1667.           MS-DOS Version 5.00
  1668. And if you have version 5,  there is an undocumented switch, /R.  Here is
  1669. its output:
  1670.           C:\>VER /R
  1671.           MS-DOS Version 5.00
  1672.           Revision A
  1673.           DOS is in HMA
  1674.  
  1675. And that does mean the version that's in memory, that you |sboot|sed the com-
  1676. puter with,  not just whatever version is installed  on the current drive
  1677. or anything.
  1678.  
  1679.  
  1680.                     <page down> for The |nVERIFY|n Command
  1681.                             The |TVERIFY|T Command
  1682.  
  1683. This command, with no parameters, tells you whether DOS's write verifica-
  1684. tion flag is turned on or off.  |nVERIFY|n ON will turn it on, and |nVERIFY|n OFF
  1685. will turn it off.  Off is the default so if you want to leave it off, you
  1686. don't have to do anything with it.   About the only time you want to turn
  1687. |nVERIFY|n on is when you're making a BACKUP,  or when you think your disk is
  1688. going bad or something.  But remember to disable your disk cache, or else
  1689. |nVERIFY|n does no good, because DOS will be verifying the data in the cache,
  1690. and just think that it's the disk that it's verifying.
  1691.  
  1692. It doesn't even verify that the data written is the same as the data that
  1693. was supposed to be written.   All it does is verify that the |nchecksum|n for
  1694. both is the same.  A |tchecksum|t is sort of like this, highly simplified:
  1695.          2 + 4 + 3 + 5 + 1 + 9 = 24
  1696. The problem  with that is,  there are lots of other  strings of data that
  1697. will give the same |nchecksum|n result:
  1698.          2 + 3 + 8 + 6 + 1 + 4 = 24
  1699. So just because two things have the same |nchecksum|n, doesn't mean that they
  1700.                        <page down> for more VERIFY
  1701. match!
  1702.  
  1703. The only real benefit  of |nVERIFY|n  is to verify that  the copy of whatever
  1704. was just written can be read from the disk, meaning that it was not writ-
  1705. ten to a bad sector.   The main thing it does  is make everything  work a
  1706. lot slower than normal.  The |nVERIFY|n command does the same thing as the /V
  1707. switch with the COPY or XCOPY commands,  only |nVERIFY|n does it all the time
  1708. instead of just when you use the /V switch, if you have |nVERIFY|n turned on.
  1709. It's just a lot more sensible to use COMP or FC instead of |nVERIFY|n to make
  1710. sure any important files were properly copied.
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                      <page down> for The |nVOL|n Command
  1721.                              The |TVOL|T Command
  1722.  
  1723. This command  isn't any more fun  than VER.   All it does is tell you the
  1724. volume label of a disk.  Like this:
  1725.           C:\>VOL C:
  1726.           Volume in drive C is WHATEVER
  1727.           Volume Serial Number is 16CB-74E4
  1728.  
  1729. You could get  the same information and more,  from the DIR,  CHKDSK,  or
  1730. LABEL commands.
  1731.  
  1732. Of course, if you have DOS version 3.3 or earlier,  you won't have a ser-
  1733. ial number on your disks.
  1734.  
  1735. The volume label is stored as an entry in the root directory of the disk,
  1736. even though it doesn't  take up any disk space.   The CHKDSK command will
  1737. count it as a Hidden file,  because CHKDSK  doesn't understand the Volume
  1738. attributes, so it interprets them as Hidden attributes instead.
  1739.  
  1740.                    <page down> for Reserved DOS Devices
  1741.                            Reserved DOS |tDevice|1s|t
  1742.  
  1743. A device driver  is a piece of software  that tells DOS  how to deal with
  1744. some |nexternal|n peripheral device that connects to the computer.   Well DOS
  1745. already knows how to deal with  a few peripheral devices,  because it has
  1746. some built-in device drivers for those devices.
  1747.  
  1748. These devices  that DOS automatically knows  how to work with  have their
  1749. very own special names,  and you mustn't try to use  those names for any-
  1750. thing else, such as filenames or anything.   For example, if you tried to
  1751. use the command COPY FILE.TXT |nNUL|n.TXT to make a copy of FILE.TXT and call
  1752. it |nNUL|n.TXT,  DOS would completely ignore  the .TXT extension  and use the
  1753. device |nNUL|n instead of the filename you thought you were using.  DOS would
  1754. copy the FILE.TXT file to the |nNUL|n device, which means "nowhere",  and you
  1755. would not end up having the intended copy of that file at all.
  1756.  
  1757. Why does the |TNUL|T device mean  "nowhere"?   Well,  it just does.   It is a
  1758. name for a device that doesn't really exist.   What good is it?   Plenty.
  1759. For one thing,  if you want to check the integrity  of a file that's sit-
  1760.                        <page down> for more Device|1s
  1761. ting on a disk  that you think  you might have damaged,  you can copy the
  1762. file to the NUL device  and if DOS gives an error message,  then you know
  1763. the file has been damaged.  If there's no error message then the copy was
  1764. successful,  which means the file was readable.   Of course you could al-
  1765. ways just copy the file to another disk or directory, but unless you wan-
  1766. ted an extra copy of it anyway,  then you'll just have to delete the file
  1767. after the test.   Using NUL as the COPY command's  destination saves that
  1768. step.
  1769.  
  1770. If you get a message "|sSector not found|s" from some program, but it doesn't
  1771. give you any clue  as to which file  has the bad sector,  you can just go
  1772. into that program's directory and type  COPY *.* NUL  and since DOS shows
  1773. you the name of each file as it begins copying it,  then when the "Sector
  1774. not found" or "Read fault error" message comes, the filename that's list-
  1775. ed right before the error message,  is the file that's got the bad sector
  1776. in it, and you can use the RECOVER command to mark that bad sector out in
  1777. the FAT so that DOS will never again put one of your files into that spot
  1778. on the disk.  (Be sure to read my RECOVER chapter before you do that!)
  1779.  
  1780.                        <page down> for more Device|1s
  1781. The most common  use for the  NUL device  is to make  the execution  of a
  1782. batch file cleaner.   Suppose you have COPY commands in your AUTOEXEC.BAT
  1783. file that copy files to your RAMdisk.  Well after each of those files are
  1784. copied,  DOS shows  the message  "1 File(s) copied"  on the screen.   You
  1785. don't want  to look at that  every time  you boot your computer,  do you?
  1786. Well you could put  > NUL at the end of each COPY command,  and since the
  1787. "1 File(s) copied" message is sent to STanDard OUTput,  the > symbol will
  1788. use redirection to send that message to the NUL device and you won't have
  1789. to look at it on the screen anymore.
  1790.  
  1791. The |TPRN|T device is just another name for |nLPT1|n.
  1792.  
  1793. |TAUX|T is another name for COM1.
  1794.  
  1795. |TLPT1|T is the first parallel port, or printer port.   If you have a printer
  1796. hooked up to it, you can print out a file by typing COPY FILE.EXT |nLPT1|n or
  1797. COPY FILE.EXT |nPRN|n.   If your printer  is hooked up  to a serial port  in-
  1798. stead,  you can use the MODE command,  as in MODE |nLPT1|n = COM1 to redirect
  1799. everything that DOS sends to |nLPT1|n, to COM1 instead.   Then you'll be able
  1800.                        <page down> for more Device|1s
  1801. to use the PRN device as if your printer was on LPT1.
  1802.  
  1803. |TCOM1|T is the first serial port, or communications port.  Modems, printers,
  1804. and mice  are three things  that are  very commonly  connected  to serial
  1805. ports.   If your modem has gone offhook  and you can't get it to hang up,
  1806. you can use  the command  ECHO ATH0 > |nCOM1|n  if your modem  is on |nCOM1|n, to
  1807. make it hang up.   (If your modem is Hayes-compatible  and uses the Hayes
  1808. AT command set, that is.)
  1809.  
  1810. What's the difference between  a parallel port and a serial port?   Oh, a
  1811. big difference!   A serial port sends bits (eighths of a byte) of data in
  1812. a serial fashion, that is, one after another.  Just one bit at a time.  A
  1813. parallel port sends data through eight parallel wires, so that eight bits
  1814. (one byte) go through the port at a time.   So it's pretty safe to assume
  1815. that  a parallel port  will send  a certain amount  of information  eight
  1816. times as fast as a serial port will.  But printers are just about the on-
  1817. ly things that are very commonly hooked up to parallel ports.  Modems and
  1818. mice just can't use parallel ports,  even though it would be nice if they
  1819. could because of the speed difference.
  1820.                        <page down> for more Device|1s
  1821. The |TCLOCK$|T device can't really be used  for any purpose  from the command
  1822. line or anything.   It refers to the clock that DOS uses to keep track of
  1823. elapsed time.   (This is  not the same  as any  battery-backed  clock you
  1824. might have installed  on your system.)   Whatever time this clock says is
  1825. the time that will be listed  in a file's directory entry  every time you
  1826. update it.   The only reason you need to know  the name of this device is
  1827. just so you never try to use that name for a filename,  since it is a re-
  1828. served DOS device name.
  1829.  
  1830. Ok,  I saved the best device  for last.   |TCON|T is the device that DOS uses
  1831. for STanDard INput (STDIN),  STanDard OUTput (STDOUT), and STanDard ERRor
  1832. (STDERR).   Unless there has been some redirection performed,  then STDIN
  1833. is the keyboard and STDOUT  is the monitor screen.   STDERR is always the
  1834. monitor.   There are a whole lot of things you can do with the |nCON|n device
  1835. name,  such as COPY |nCON|n PRN to make your printer act sort of like a type-
  1836. writer, or COPY |nCON|n FILENAME to create an ASCII file without using a text
  1837. editor or anything.
  1838.  
  1839. A lot of books  show the device names  as |nCON|n: or PRN: or LPT1:, with the
  1840.                        <page down> for more Device|1s
  1841. colons after them,  but they work  just fine with  or without the colons.
  1842. I think the colons are mostly used  just to differentiate  between device
  1843. names and filenames,  so that you don't think  they're referring  to some
  1844. filename when they say CON:.
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.                    <page down> for |nCode Page|n Switching
  1861.                            |tCode Page|t Switching
  1862.  
  1863. |TCHCP|T, |TCOUNTRY|T, |TGRAFTABL|T, |TKEYB|T, KEYB??, |TNLSFUNC|T, DISPLAY.SYS, PRINTER.SYS,
  1864. and SELECT  are all commands  and |sdevice driver|ss that have  almost no use
  1865. other than to enable |ncode page|n switching; ignore them.  The files in your
  1866. DOS directory  which have the extension  .CPI are  the tables that  these
  1867. commands use.   Ignore them too.   The MODE command is also used for code
  1868. page switching, but at least it has useful functions as well.
  1869.  
  1870. Oh, ok, I'll at least tell you what |ncode page|n switching actually is.  IBM
  1871. could have picked  a much simpler name for this stuff.   All it means is,
  1872. setting DOS up to be able to use characters like Ä and ö for foreign lan-
  1873. guage alphabets, instead of the alphabet that we use here in the good old
  1874. U. S. of A.   The |ncode page|n used for plain old English is the default, so
  1875. you don't have to set up anything special to use it.   But if you want to
  1876. type in a different language,  then you need to set up its |ncode page|n,  so
  1877. you can use those foreign-language characters.   So that's what |ncode page|n
  1878. switching is all about.
  1879.  
  1880.          For beginning of File 6, see Abort, Retry, Fail, Ignore
  1881. |tAUTOEXEC.BAT|t|fSIMPLY1|f
  1882. |TCLS|T|fSIMPLY1|f
  1883. |TFAT|T|fSIMPLY1|f
  1884. |tUNDELETE|t|fSIMPLY1|f
  1885. |tXCOPY|t|fSIMPLY1|f
  1886. |tBatch|t|fSIMPLY2|f
  1887. |TCALL|T|fSIMPLY2|f
  1888. |TECHO|T|fSIMPLY2|f
  1889. |TEXIST|T|fSIMPLY2|f
  1890. |TFOR|T|fSIMPLY2|f
  1891. |TGOTO|T|fSIMPLY2|f
  1892. |TIF|T|fSIMPLY2|f
  1893. |TMORE|T|fSIMPLY2|f
  1894. |TNOT|T|fSIMPLY2|f
  1895. |TPAUSE|T|fSIMPLY2|f
  1896. |tRedirection|t|fSIMPLY2|f
  1897. |TREM|T|fSIMPLY2|f
  1898. |TSHIFT|T|fSIMPLY2|f
  1899. |TTEMP|T|fSIMPLY2|f
  1900. |tBytes|t|fSIMPLY3|f
  1901. |tCache|t|fSIMPLY3|f
  1902. |TCMOS|T|fSIMPLY3|f
  1903. |tDEVICEHIGH|t|fSIMPLY3|f
  1904. |TDO|1S|T|fSIMPLY3|f
  1905. |tHMA|t|fSIMPLY3|f
  1906. |tLOADHIGH|t|fSIMPLY3|f
  1907. |tMemory|t|fSIMPLY3|f
  1908. |TMODE|T|fSIMPLY3|f
  1909. |tRAMdisk|t|fSIMPLY3|f
  1910. |TRECOVER|T|fSIMPLY3|f
  1911. |tSector not found|t|fSIMPLY3|f
  1912. |TSELECT|T|fSIMPLY3|f
  1913. |tsetup|t|fSIMPLY3|f
  1914. |TSUBST|T|fSIMPLY3|f
  1915. |tANSI.SYS|t|fSIMPLY4|f
  1916. |tbad sector|t|fSIMPLY4|f
  1917. |TBREAK|T|fSIMPLY4|f
  1918. |TBUFFERS|T|fSIMPLY4|f
  1919. |TCOMSPEC|T|fSIMPLY4|f
  1920. |tCONFIG.SYS|t|fSIMPLY4|f
  1921. |tDevice Driver|t|fSIMPLY4|f
  1922. |TDEVIC|1E|T|fSIMPLY4|f
  1923. |TDRIVPARM|T|fSIMPLY4|f
  1924. |tEnvironment|t|fSIMPLY4|f
  1925. |TFCBS|T|fSIMPLY4|f
  1926. |TFILES|T|fSIMPLY4|f
  1927. |tfloppy|t|fSIMPLY4|f
  1928. |TFORMAT|T|fSIMPLY4|f
  1929. |tIBMBIO.COM|t|fSIMPLY4|f
  1930. |tIBMDOS.COM|t|fSIMPLY4|f
  1931. |TINSTALL|T|fSIMPLY4|f
  1932. |tIO.SYS|t|fSIMPLY4|f
  1933. |TJOIN|T|fSIMPLY4|f
  1934. |TLABEL|T|fSIMPLY4|f
  1935. |TLASTDRIVE|T|fSIMPLY4|f
  1936. |tMSDOS.SYS|t|fSIMPLY4|f
  1937. |tPATH|t|fSIMPLY4|f
  1938. |tPROMPT|t|fSIMPLY4|f
  1939. |TSET|T|fSIMPLY4|f
  1940. |TSHELL|T|fSIMPLY4|f
  1941. |TSTACKS|T|fSIMPLY4|f
  1942. |TSWITCHAR|T|fSIMPLY4|f
  1943. |TSWITCHES|T|fSIMPLY4|f
  1944. |tvolume|t|fSIMPLY4|f
  1945. |t*.*|t|fSIMPLY6|f
  1946. |tAbort, Retry, Fail, Ignore|t|fSIMPLY6|f
  1947. |tASCII|t|fSIMPLY6|f
  1948. |TBBS|T|fSIMPLY6|f
  1949. |tbinary|t|fSIMPLY6|f
  1950. |tBoot|t|fSIMPLY6|f
  1951. |tBoo|1t Disk|t|fSIMPLY6|f
  1952. |tcluster|t|fSIMPLY6|f
  1953. |tdecimal|t|fSIMPLY6|f
  1954. |tdisk full|t|fSIMPLY6|f
  1955. |tDisks|t|fSIMPLY6|f
  1956. |thexadecimal|t|fSIMPLY6|f
  1957. |tKeyboard|t|fSIMPLY6|f
  1958. |tParameters|t|fSIMPLY6|f
  1959. |tpublic domain|t|fSIMPLY6|f
  1960. |tReboot|t|fSIMPLY6|f
  1961. |tReplaceable|t|fSIMPLY6|f
  1962. |tsector|t|fSIMPLY6|f
  1963. |tShareware|t|fSIMPLY6|f
  1964. |tslack space|t|fSIMPLY6|f
  1965. |tWildcards|t|fSIMPLY6|f
  1966. |tAccess denied|t|fSIMPLY7|f
  1967. |tArchive|t|fSIMPLY7|f
  1968. |TASSIGN|T|fSIMPLY7|f
  1969. |tAttributes|t|fSIMPLY7|f
  1970. |TATTRIB|T|fSIMPLY7|f
  1971. |TBACKUP|T|fSIMPLY7|f
  1972. |TCHKDSK|T|fSIMPLY7|f
  1973. |TCOMP|T|fSIMPLY7|f
  1974. |TDOSSHELL|T|fSIMPLY7|f
  1975. |tediting keys|t|fSIMPLY7|f
  1976. |TFC|T|fSIMPLY7|f
  1977. |tfragmented|t|fSIMPLY7|f
  1978. |TGWBASIC|T|fSIMPLY7|f
  1979. |tHidden|t|fSIMPLY7|f
  1980. |toverlay|t|fSIMPLY7|f
  1981. |TQBASIC|T|fSIMPLY7|f
  1982.